diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -553,10 +553,22 @@ def getremotechanges(ui, repo, other, on 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") + + with other.commandexecutor() as e: + cg = e.callcommand('changegroup', { + 'nodes': incoming, + 'source': 'incoming', + }).result() + rheads = None else: - cg = other.changegroupsubset(incoming, rheads, 'incoming') + with other.commandexecutor() as e: + cg = e.callcommand('changegroupsubset', { + 'bases': incoming, + 'heads': rheads, + 'source': 'incoming', + }).result() + if localrepo: bundletype = "HG10BZ" else: diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1693,13 +1693,24 @@ def _pullchangeset(pullop): cg = pullop.remote.getbundle('pull', common=pullop.common, heads=pullop.heads or pullop.rheads) elif pullop.heads is None: - cg = pullop.remote.changegroup(pullop.fetch, 'pull') + with pullop.remote.commandexecutor() as e: + cg = e.callcommand('changegroup', { + 'nodes': pullop.fetch, + 'source': 'pull', + }).result() + elif not pullop.remote.capable('changegroupsubset'): raise error.Abort(_("partial pull cannot be done because " "other repository doesn't support " "changegroupsubset.")) else: - cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull') + with pullop.remote.commandexecutor() as e: + cg = e.callcommand('changegroupsubset', { + 'bases': pullop.fetch, + 'heads': pullop.heads, + 'source': 'pull', + }).result() + bundleop = bundle2.applybundle(pullop.repo, cg, tr, 'pull', pullop.remote.url()) pullop.cgresult = bundle2.combinechangegroupresults(bundleop) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -320,7 +320,8 @@ class localpeer(repository.peer): # End of peer interface. -class locallegacypeer(repository.legacypeer, localpeer): +@zi.implementer(repository.ipeerlegacycommands) +class locallegacypeer(localpeer): '''peer extension which implements legacy methods too; used for tests with restricted capabilities''' @@ -335,8 +336,8 @@ class locallegacypeer(repository.legacyp def branches(self, nodes): return self._repo.branches(nodes) - def changegroup(self, basenodes, source): - outgoing = discovery.outgoing(self._repo, missingroots=basenodes, + def changegroup(self, nodes, source): + outgoing = discovery.outgoing(self._repo, missingroots=nodes, missingheads=self._repo.heads()) return changegroup.makechangegroup(self._repo, outgoing, '01', source) diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -190,10 +190,10 @@ class ipeerlegacycommands(zi.Interface): Returns an iterable of iterables with the resolved values for each node. """ - def changegroup(nodes, kind): + def changegroup(nodes, source): """Obtain a changegroup with data for descendants of specified nodes.""" - def changegroupsubset(bases, heads, kind): + def changegroupsubset(bases, heads, source): pass class ipeercommandexecutor(zi.Interface): @@ -285,9 +285,6 @@ class ipeerbase(ipeerconnection, ipeerca All peer instances must conform to this interface. """ -class ipeerbaselegacycommands(ipeerbase, ipeerlegacycommands): - """Unified peer interface that supports legacy commands.""" - @zi.implementer(ipeerbase) class peer(object): """Base class for peer repositories.""" @@ -312,10 +309,6 @@ class peer(object): _('cannot %s; remote repository does not support the %r ' 'capability') % (purpose, name)) -@zi.implementer(ipeerbaselegacycommands) -class legacypeer(peer): - """peer but with support for legacy wire protocol commands.""" - class ifilerevisionssequence(zi.Interface): """Contains index data for all revisions of a file. diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -308,7 +308,8 @@ class peerexecutor(object): else: f.set_result(result) -class wirepeer(repository.legacypeer): +@zi.implementer(repository.ipeerlegacycommands) +class wirepeer(repository.peer): """Client-side interface for communicating with a peer repository. Methods commonly call wire protocol commands of the same name. @@ -502,12 +503,12 @@ class wirepeer(repository.legacypeer): self._abort(error.ResponseError(_("unexpected response:"), d)) return r - def changegroup(self, nodes, kind): + def changegroup(self, nodes, source): n = wireprototypes.encodelist(nodes) f = self._callcompressable("changegroup", roots=n) return changegroupmod.cg1unpacker(f, 'UN') - def changegroupsubset(self, bases, heads, kind): + def changegroupsubset(self, bases, heads, source): self.requirecap('changegroupsubset', _('look up remote changes')) bases = wireprototypes.encodelist(bases) heads = wireprototypes.encodelist(heads) diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py --- a/tests/test-check-interfaces.py +++ b/tests/test-check-interfaces.py @@ -89,8 +89,7 @@ def main(): checkzobject(badpeer()) - ziverify.verifyClass(repository.ipeerbaselegacycommands, - httppeer.httppeer) + ziverify.verifyClass(repository.ipeerbase, httppeer.httppeer) checkzobject(httppeer.httppeer(None, None, None, dummyopener(), None, None)) ziverify.verifyClass(repository.ipeerconnection, @@ -111,13 +110,11 @@ def main(): wireprotov1peer.peerexecutor) checkzobject(wireprotov1peer.peerexecutor(None)) - ziverify.verifyClass(repository.ipeerbaselegacycommands, - sshpeer.sshv1peer) + ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv1peer) checkzobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, dummypipe(), dummypipe(), None, None)) - ziverify.verifyClass(repository.ipeerbaselegacycommands, - sshpeer.sshv2peer) + ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv2peer) checkzobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, dummypipe(), dummypipe(), None, None))