1633817fa67a — Oben Sonne 8 years ago
Add option --new-branch
3 files changed, 22 insertions(+), 8 deletions(-)

M autosync.py
M tests/test-autosync
M tests/test-autosync.out
M autosync.py +1 -0
@@ 214,6 214,7 @@ cmdtable = {
     "autosync": (autosync,
         [("A", "addremove", False,
           "automatically synchronize new/missing files"),
+         ("", "new-branch", False, "automatically synchronize new branches"),
          ("i", "interval", 600, "synchronization interval in seconds"),
          ("o", "once", False, "synchronize once only, don't loop"),
          # daemon options

          
M tests/test-autosync +11 -3
@@ 38,7 38,7 @@ hg -q clone hub ra # a local clone
 hg -q clone hub rb # a local clone
 
 echo "-> start sync daemons"
-hg -R ra -v autosync -A -i $SYNCIVAL -D --pid-file=sd-ra.pid -d "0 0" -u ra
+hg -R ra -v autosync -A -i $SYNCIVAL -D --pid-file=sd-ra.pid -d "0 0" -u ra --new-branch
 sleep $(($SYNCIVAL / 2))
 hg -R rb -v autosync -A -i $SYNCIVAL -D --pid-file=sd-rb.pid -d "0 0" -u rb
 sleep $(($SYNCIVAL / 4))

          
@@ 71,6 71,14 @@ echo b > rb/f5
 wait # ra commits and pushes | rb commits, pulls, merge and pushes | ra pulls
 NREV=$((NREV+3))
 
+echo "-> new branch in ra"
+hg -R ra branch test
+wait # ra commits and pushes | rb commits, pulls, merge and pushes | ra pulls
+NREV=$((NREV+1))
+
+echo "-> back to default branch in ra"
+hg -R ra update default
+
 echo "-> conflicting change in ra and rb"
 echo a > ra/f6
 echo b > rb/f6

          
@@ 138,8 146,8 @@ NREV=$((NREV+4))
 
 echo "-> check if repos equal"
 
-ID_RA=`hg -R ra id -i --debug -r tip`
-ID_RB=`hg -R rb id -i --debug -r tip`
+ID_RA="`hg -R ra heads --template '{node} '`"
+ID_RB="`hg -R rb heads --template '{node} '`"
 
 echo "-> id ra: $ID_RA"
 echo "-> id rb: $ID_RB"

          
M tests/test-autosync.out +10 -5
@@ 8,6 8,11 @@ 
 -> waiting for synchronization (8 seconds)
 -> non-conflicting changes in ra and rb
 -> waiting for synchronization (8 seconds)
+-> new branch in ra
+marked working directory as branch test
+-> waiting for synchronization (8 seconds)
+-> back to default branch in ra
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 -> conflicting change in ra and rb
 -> waiting for synchronization (8 seconds)
 -> manually resolve merge conflict

          
@@ 23,8 28,8 @@ 
 -> conflicting change in ra and rb while not completely synchronized
 -> run autosync in both repos, non-looping and non-daemon
 -> check if repos equal
--> id ra: 139abc8c7190367c38725b0a2cfbfaff3c0fe3ac
--> id rb: 139abc8c7190367c38725b0a2cfbfaff3c0fe3ac
--> nrev expected: 21
--> nrev ra      : 21
--> nrev rb      : 21
+-> id ra: 139abc8c7190367c38725b0a2cfbfaff3c0fe3ac 158e3bc2d14b27704d7f9a0fca5d1f6687ad42e0 
+-> id rb: 139abc8c7190367c38725b0a2cfbfaff3c0fe3ac 158e3bc2d14b27704d7f9a0fca5d1f6687ad42e0 
+-> nrev expected: 22
+-> nrev ra      : 22
+-> nrev rb      : 22