# HG changeset patch # User Peter Arrenbrecht # Date 2011-05-23 18:35:10 # Node ID 9ac479758d3b2c5b65175228659bf3cae1eafd48 # Parent 0c35514734e764e1b7e642143931e9b43c7c7be3 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 @@ def getremotechanges(ui, repo, other, on 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 @@ def getremotechanges(ui, repo, other, on # 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: