incoming: handle phases the same as pull
authorEric Sumner <ericsumner@fb.com>
Thu, 18 Dec 2014 12:33:17 -0800
changeset 23633 96c3cbec006f
parent 23632 e7fcf58acd71
child 23634 bbd50e13c006
incoming: handle phases the same as pull Now that bundlerepo can move phases safely, 'hg incoming' can share its phase handling code with pull to better reflect what would actually show up.
mercurial/bundlerepo.py
tests/test-setdiscovery.t
tests/test-treediscovery.t
--- a/mercurial/bundlerepo.py	Thu Dec 18 12:22:43 2014 -0800
+++ b/mercurial/bundlerepo.py	Thu Dec 18 12:33:17 2014 -0800
@@ -350,6 +350,16 @@
         repopath, bundlename = parentpath, path
     return bundlerepository(ui, repopath, bundlename)
 
+class bundletransactionmanager(object):
+    def transaction(self):
+        return None
+
+    def close(self):
+        raise NotImplementedError
+
+    def release(self):
+        raise NotImplementedError
+
 def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None,
                      force=False):
     '''obtains a bundle of changes incoming from other
@@ -418,6 +428,14 @@
 
     csets = localrepo.changelog.findmissing(common, rheads)
 
+    if bundlerepo:
+        reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]]
+        remotephases = other.listkeys('phases')
+
+        pullop = exchange.pulloperation(bundlerepo, other, heads=reponodes)
+        pullop.trmanager = bundletransactionmanager()
+        exchange._pullapplyphases(pullop, remotephases)
+
     def cleanup():
         if bundlerepo:
             bundlerepo.close()
--- a/tests/test-setdiscovery.t	Thu Dec 18 12:22:43 2014 -0800
+++ b/tests/test-setdiscovery.t	Thu Dec 18 12:33:17 2014 -0800
@@ -354,6 +354,7 @@
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db
   "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
   $ cat errors.log
 
   $ cd ..
--- a/tests/test-treediscovery.t	Thu Dec 18 12:22:43 2014 -0800
+++ b/tests/test-treediscovery.t	Thu Dec 18 12:33:17 2014 -0800
@@ -509,6 +509,7 @@
   "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
   "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
   "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=heads HTTP/1.1" 200 -
   "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961