[PATCH 4 of 4] bundlerepo: make getremotechanges support filtering of incoming

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Mon May 23 13:38:56 CDT 2011


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1306175710 -7200
# Node ID 9974f7c47b5cf7649a92621311273365093bbaba
# Parent  3c190b62f805150f849f7b131b3a0e6f9fb6feca
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.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -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:


More information about the Mercurial-devel mailing list