Oben Sonne avatar Oben Sonne committed 1633817

Add option --new-branch

Comments (0)

Files changed (3)

     "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

tests/test-autosync

 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))
 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
 
 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"

tests/test-autosync.out

 -> 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
 -> 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.