changeset 31:cae0fba14b8a

Added chech for reps capability.
author Oleksander Gavenko <gavenko_a@3g.ua>
date Mon, 03 Mar 2008 23:01:20 +0200
parents 9450729571ee
children 4a989af8827f
files hg/hgrepsync
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hg/hgrepsync	Mon Mar 03 22:47:36 2008 +0200
+++ b/hg/hgrepsync	Mon Mar 03 23:01:20 2008 +0200
@@ -89,6 +89,19 @@
     return 0;
 }
 
+# Expect two args - path to compared rep.
+CheckRepCompatibility() {
+    REP1_ZERO_REV=`hg -R $1 id -i -r 0`
+    REP2_ZERO_REV=`hg -R $2 id -i -r 0`
+
+    if [ $REP1_ZERO_REV = $REP2_ZERO_REV ] ; then
+        return 0;
+    else
+        MSG="Reps $1 and $2 are different!"
+        return 1;
+    fi
+}
+
 # ##########
 # Main work.
 # ##########
@@ -128,10 +141,20 @@
     # Заполняем HG_PULL_DIR новыми changeset из эталонного и промежуточного репозиториев.
     if [ -d $HG_PUSH_DIR/$dir ] ; then
         if [ -d $HG_PULL_DIR/$dir ] ; then
+            if CheckRepCompatibility $HG_PULL_DIR/$dir $HG_PUSH_DIR/$dir; then :
+            else
+                PrintLog
+                exit 1;
+            fi
             hg -R $HG_PULL_DIR/$dir pull $HG_PUSH_DIR/$dir >>$LOG_FILE 2>&1
         else
             hg clone $HG_PUSH_DIR/$dir $HG_PULL_DIR/$dir >>$LOG_FILE 2>&1
         fi
+        if CheckRepCompatibility $HG_PULL_DIR/$dir ./$dir; then :
+        else
+            PrintLog
+            exit 1;
+        fi
         hg -R $HG_PULL_DIR/$dir pull ./$dir >>$LOG_FILE 2>&1
     else
         MSG="$dir proj not found in $HG_PUSH_DIR dir."