changeset 426:e2a15ee060dd

Add future support of HTTP protocol for master repos.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Wed, 26 Oct 2011 16:44:26 +0300
parents fb1a55d0f7eb
children 263127ef53df
files hg/hgsyncew
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hg/hgsyncew	Wed Oct 26 16:34:45 2011 +0300
+++ b/hg/hgsyncew	Wed Oct 26 16:44:26 2011 +0300
@@ -10,6 +10,8 @@
 
 LOG_FILE=$UTIL_NAME.log
 
+HTTP_USED=no
+
 Usage() {
     echo Sync working repo set with etalon repo set.
     echo "Usage:"
@@ -86,6 +88,7 @@
     return 1;
 }
 
+# May set HTTP_USED to 'yes'.
 Check_HG_REP_CONF() {
     if [ x$HG_PUSH_DIR = x ] ; then
         MSG="HG_PUSH_DIR not set in $HG_REP_CONF"
@@ -93,8 +96,14 @@
     fi
     if [ -d $HG_PUSH_DIR ] ; then :
     else
-        MSG="HG_PUSH_DIR from $HG_REP_CONF point for non existing dir."
-        return 1;
+        http=${HG_PUSH_DIR#http://}
+        http=${http#https://}
+        if [ "$http" = $HG_PUSH_DIR ]; then
+            MSG="HG_PUSH_DIR from $HG_REP_CONF point for non existing dir."
+            return 1
+        else
+            HTTP_USED=yes
+        fi
     fi
     return 0;
 }
@@ -162,7 +171,7 @@
     MSG="'$dir' repo."
     PrintLog PROCESSING
 
-    if [ -d $HG_PUSH_DIR/$dir ]; then
+    if [ -d $HG_PUSH_DIR/$dir -a $HTTP_USED = no ]; then
         if CheckRepCompatibility ./$dir $HG_PUSH_DIR/$dir; then :
         else
             MSG="It seems repo '$dir' and etalon repo not compatable."
@@ -192,7 +201,7 @@
     fi
 
     # Если указана опция --push, безопасно переносим изменения в эталонный репозиторий.
-    if [ $NEED_PUSH = y ]; then
+    if [ $NEED_PUSH = y -a $HTTP_USED = no ]; then
         HEAD_CNT=`hg -R ./$dir head --template '{node}\n' | wc -l`
         case $HEAD_CNT in
             1)