Check for already present repos in ChiliProject

This commit is contained in:
Kolan Sh 2012-04-18 16:06:26 +04:00
parent a72838a956
commit e90b48852a
1 changed files with 9 additions and 0 deletions

View File

@ -52,6 +52,15 @@ for v in $CHILI_ID_GITORIOUS_REPO; do
case $((n%2)) in case $((n%2)) in
0) chili_project_id=$v ;; 0) chili_project_id=$v ;;
1) gitorious_path=$GITORIOUS_REPOS_PATH/$v.git 1) gitorious_path=$GITORIOUS_REPOS_PATH/$v.git
# Test for already present repo
ALREADY_EXIST=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT id
FROM $CHILI_MYSQL_DBNAME.repositories
WHERE url='$gitorious_path'
OR root_url='$gitorious_path'" \
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
[ "$ALREADY_EXIST" != "" ] && continue
# insert to chiliproject.repositories
echo "insert $chili_project_id: $gitorious_path" echo "insert $chili_project_id: $gitorious_path"
mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "INSERT INTO $CHILI_MYSQL_DBNAME.repositories(project_id, mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "INSERT INTO $CHILI_MYSQL_DBNAME.repositories(project_id,
url, url,