changeset 30:9450729571ee

Improve debug ability.
author Oleksander Gavenko <gavenko_a@3g.ua>
date Mon, 03 Mar 2008 22:47:36 +0200
parents dc247a0bfda9
children cae0fba14b8a
files hg/hgrepsync
diffstat 1 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hg/hgrepsync	Mon Mar 03 21:37:31 2008 +0200
+++ b/hg/hgrepsync	Mon Mar 03 22:47:36 2008 +0200
@@ -11,9 +11,6 @@
 # не возвращая код ошибки:
 # abort: working dir not at a head rev - use "hg update" or merge with an explicit rev
 
-# XXX debug.
-# export HOME=E:\\home\\devel\\tmp\\1\\home
-
 LOG_FILE=hgrep.log
 
 PrintHelp() {
@@ -46,15 +43,22 @@
     fi
 }
 
-# Check on wrong place.
-Check_HG_REP_CONF_exist() {
+Get_HG_REP_CONF() {
+    # Если есть локальный файл конфигурации репозиториев (полезно для отладки).
+    if [ -e hg-rep ]; then
+        HG_REP_CONF=./hg-rep
+        return 0;
+    fi
+
+    # Иначе ищем по стандартному пути.
     if [ x$HOME = x ] ; then
         MSG="Var HOME not set."
         return 1;
     fi
-    if [ -e $HOME/.gav/hg-rep ] ; then :
+    HG_REP_CONF=$HOME/.gav/hg-rep
+    if [ -e $HG_REP_CONF ] ; then :
     else
-        MSG="File $HOME/.gav/hg-rep not exist."
+        MSG="File $HG_REP_CONF not exist."
         return 1;
     fi
 
@@ -104,15 +108,13 @@
     exit 1;
 fi
 
-if Check_HG_REP_CONF_exist; then :
+if Get_HG_REP_CONF; then
+    . $HG_REP_CONF
 else
     PrintLog
     exit 1;
 fi
 
-HG_REP_CONF=$HOME/.gav/hg-rep
-. $HG_REP_CONF
-
 if Check_HG_REP_CONF ; then :
 else
     PrintLog