changeset 14412:9ac479758d3b

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.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Mon, 23 May 2011 20:35:10 +0200
parents 0c35514734e7
children 5ef18e28df19
files mercurial/bundlerepo.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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: