changeset 47:0a6b8332294a

Теперь работает.
author Oleksander Gavenko <gavenko_a@3g.ua>
date Sun, 23 Mar 2008 15:06:20 +0200
parents df72500132f9
children df490bd7aeb9
files hg/hgsyncew
diffstat 1 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hg/hgsyncew	Sun Mar 23 14:51:18 2008 +0200
+++ b/hg/hgsyncew	Sun Mar 23 15:06:20 2008 +0200
@@ -104,6 +104,9 @@
         PrintHelp
         exit 0;
         ;;
+    x--push)
+        NEED_PUSH=y
+        ;;
 esac
 
 echo >>$LOG_FILE 2>&1
@@ -138,6 +141,7 @@
 
     #   .
     [ -d $dir/.hg ] || continue
+
     MSG="Visit to $dir rep."
     PrintLog INFO
 
@@ -155,15 +159,25 @@
     fi
 
     #  changeset     .
-    echo hg -R ./$dir pull $HG_PUSH_DIR/$dir >>$LOG_FILE 2>&1
+    hg -R ./$dir pull $HG_PUSH_DIR/$dir >>$LOG_FILE 2>&1
 
+    #    --push,      .
     if [ $NEED_PUSH = y ]; then
-        HEAD_CNT=`hg -R ./$dir head | grep "changeset:" | wc -l - | sed 's/ *\([0-9]*\) -/\1/'`
-        echo HEAD_CNT: $HEAD_CNT
+        HEAD_CNT=`hg -R ./$dir head --template '{node}\n' | wc -l - | sed 's/ *\([0-9]*\) -/\1/'`
         case $HEAD_CNT in
             1)
-                echo hg -R ./$dir push $HG_PUSH_DIR/$dir >>$LOG_FILE 2>&1
-                MSG="Added new changesets to etalon rep."
+                CHANGESET_CNT=`hg --quiet -R ./$dir out --template '{node}\n' $HG_PUSH_DIR/$dir | wc -l - | sed 's/ *\([0-9]*\) -/\1/'`
+                case $CHANGESET_CNT in
+                    0) ;;
+                    *)
+                        hg -R ./$dir push $HG_PUSH_DIR/$dir >>$LOG_FILE 2>&1
+                        MSG="Added new changesets to etalon rep."
+                        PrintLog INFO
+                        ;;
+                esac
+                ;;
+            *)
+                MSG="You must manually merge $dir rep."
                 PrintLog INFO
                 ;;
         esac