bundlerepo: make getremotechanges support filtering of incoming
authorPeter Arrenbrecht <peter.arrenbrecht@gmail.com>
Mon, 23 May 2011 20:35:10 +0200
changeset 14412 9ac479758d3b
parent 14411 0c35514734e7
child 14413 5ef18e28df19
bundlerepo: make getremotechanges support filtering of incoming Extensions can hook discovery.findcommonincoming to filter out unwanted remote changesets. This patch makes getremotechanges respect the changed remote heads returned by such extensions.
mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py	Mon May 23 20:32:29 2011 +0200
+++ b/mercurial/bundlerepo.py	Mon May 23 20:35:10 2011 +0200
@@ -326,15 +326,14 @@
     if bundlename or not other.local():
         # create a bundle (uncompressed if other repo is not local)
 
-        if onlyheads is None and other.capable('changegroupsubset'):
-            onlyheads = rheads
-
         if other.capable('getbundle'):
-            cg = other.getbundle('incoming', common=common, heads=onlyheads)
-        elif onlyheads is None:
+            cg = other.getbundle('incoming', common=common, heads=rheads)
+        elif onlyheads is None and not other.capable('changegroupsubset'):
+            # compat with older servers when pulling all remote heads
             cg = other.changegroup(incoming, "incoming")
+            rheads = None
         else:
-            cg = other.changegroupsubset(incoming, onlyheads, 'incoming')
+            cg = other.changegroupsubset(incoming, rheads, 'incoming')
         bundletype = other.local() and "HG10BZ" or "HG10UN"
         fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
         # keep written bundle?
@@ -346,7 +345,7 @@
             # this repo contains local and other now, so filter out local again
             common = repo.heads()
 
-    csets = localrepo.changelog.findmissing(common, onlyheads)
+    csets = localrepo.changelog.findmissing(common, rheads)
 
     def cleanup():
         if bundlerepo: