pullbundle: issue local branches in the right order
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 25 Sep 2018 13:29:49 +0200
changeset 4140 9b71aa222f8e
parent 4139 2bd652bece97
child 4141 1421ff5c5c96
pullbundle: issue local branches in the right order
hgext3rd/pullbundle.py
tests/test-pullbundle.t
--- a/hgext3rd/pullbundle.py	Tue Sep 25 12:53:34 2018 +0200
+++ b/hgext3rd/pullbundle.py	Tue Sep 25 13:29:49 2018 +0200
@@ -183,13 +183,13 @@
                     break
                 slicerevs.append(r)
             slicenodes = [node(r) for r in slicerevs]
-            localslices.extend(canonicalslices(repo, slicenodes))
+            localslices.append(canonicalslices(repo, slicenodes))
             missingrevs.difference_update(slicerevs)
             localmissing.difference_update(slicerevs)
             if localmissing:
                 head = max(localmissing)
-
-        allslices.extend(localslices)
+        for s in reversed(localslices):
+            allslices.extend(s)
     # unknown subrange might had to be computed
     repo.stablerange.save(repo)
     return [(rangeid, outgoingfromnodes(repo, nodes))
--- a/tests/test-pullbundle.t	Tue Sep 25 12:53:34 2018 +0200
+++ b/tests/test-pullbundle.t	Tue Sep 25 13:29:49 2018 +0200
@@ -984,6 +984,250 @@
    02-ee2deecf044fa5583f66188c9177b0f13332adc2-0000001024skip-0000000128size.hg
   [1]
 
+Pull with piece "not linear from head"
+--------------------------------------
+
+  $ hg -R server log -G -T '{rev}:{node}\n' -r 'branchpoint() + merge() + head() + children(branchpoint())'
+  o  2130:0f376356904fc8c1c6ceaac27990f2fd79b1f8c1
+  :
+  o    1663:1710092b3ab17a6d2ecad664580991a608537749
+  |\
+  | o  1518:c72277ff25807eb444fa48a60afb434d78c21f2f
+  | |
+  | | o  1517:1dded5aafa0f8d548f6357cc2f8882dcc4489fbf
+  | | :
+  +---o  1251:d1807e3513890ac71c2e8d10e9dc9a5b58b15d4b
+  | |
+  o |  1250:d83212ecaa436c80d6113cf915ba35e2db787e79
+  : |
+  o |  899:c31a4e0cc28d677b8020e46aa3bb2fd5ee5b1a06
+  |/
+  o  898:1388f909cd2b0685efd4e2ce076d198bce20922c
+  |
+  ~
+
+  $ hg init test-local-missing
+  $ hg -R test-local-missing pull server --rev 899 --rev 1518 --verbose
+  pulling from server
+  pullbundle-cache: "missing" set sliced into 5 subranges in *.* seconds (glob)
+  512 changesets found
+  256 changesets found
+  128 changesets found
+  4 changesets found
+  1 changesets found
+  uncompressed size of bundle content:
+     92968 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+     46596 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+     23300 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+       732 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+       188 (changelog)
+         4 (manifests)
+  adding changesets
+  adding manifests
+  adding file changes
+  added 512 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 256 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 128 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 0 files (+1 heads)
+  new changesets 1ea73414a91b:c72277ff2580
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ hg -R test-local-missing pull server --verbose
+  pulling from server
+  searching for changes
+  all local heads known remotely
+  pullbundle-cache: "missing" set sliced into 27 subranges in *.* seconds (glob)
+  4 changesets found
+  8 changesets found
+  16 changesets found
+  32 changesets found
+  64 changesets found
+  128 changesets found in caches
+  64 changesets found in caches
+  32 changesets found
+  2 changesets found
+  1 changesets found
+  4 changesets found
+  8 changesets found
+  16 changesets found
+  256 changesets found in caches
+  256 changesets found in caches
+  64 changesets found in caches
+  8 changesets found in caches
+  1 changesets found in caches
+  4 changesets found in caches
+  8 changesets found in caches
+  16 changesets found in caches
+  128 changesets found in caches
+  64 changesets found in caches
+  32 changesets found in caches
+  8 changesets found in caches
+  4 changesets found in caches
+  2 changesets found in caches
+  uncompressed size of bundle content:
+       732 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+      1460 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+      2916 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+      5828 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+     11700 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+      5892 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+       372 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+       188 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+       740 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+      1476 (changelog)
+         4 (manifests)
+  uncompressed size of bundle content:
+      2948 (changelog)
+         4 (manifests)
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 8 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 16 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 32 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 64 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 128 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 64 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 32 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 8 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 16 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 256 changesets with 0 changes to 0 files (-1 heads)
+  adding changesets
+  adding manifests
+  adding file changes
+  added 256 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 64 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 8 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 0 files (+1 heads)
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 8 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 16 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 128 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 64 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 32 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 8 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 0 files
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 0 changes to 0 files
+  new changesets e600b80a2fc8:1dded5aafa0f
+  (run 'hg update' to get a working copy)
+
 Test cache setting
 ==================
 
@@ -996,7 +1240,7 @@
   > cache-directory=$TESTTMP/bundle-cache
   > EOF
 
-  $ hg clone --pull server client5
+  $ hg clone --pull server other-cache-directory
   requesting all changes
   pullbundle-cache: "missing" set sliced into 15 subranges in *.* seconds (glob)
   adding changesets