Show More
@@ -553,10 +553,22 b' def getremotechanges(ui, repo, other, on' | |||
|
553 | 553 | cg = other.getbundle('incoming', common=common, heads=rheads) |
|
554 | 554 | elif onlyheads is None and not other.capable('changegroupsubset'): |
|
555 | 555 | # compat with older servers when pulling all remote heads |
|
556 | cg = other.changegroup(incoming, "incoming") | |
|
556 | ||
|
557 | with other.commandexecutor() as e: | |
|
558 | cg = e.callcommand('changegroup', { | |
|
559 | 'nodes': incoming, | |
|
560 | 'source': 'incoming', | |
|
561 | }).result() | |
|
562 | ||
|
557 | 563 | rheads = None |
|
558 | 564 | else: |
|
559 | cg = other.changegroupsubset(incoming, rheads, 'incoming') | |
|
565 | with other.commandexecutor() as e: | |
|
566 | cg = e.callcommand('changegroupsubset', { | |
|
567 | 'bases': incoming, | |
|
568 | 'heads': rheads, | |
|
569 | 'source': 'incoming', | |
|
570 | }).result() | |
|
571 | ||
|
560 | 572 | if localrepo: |
|
561 | 573 | bundletype = "HG10BZ" |
|
562 | 574 | else: |
@@ -1693,13 +1693,24 b' def _pullchangeset(pullop):' | |||
|
1693 | 1693 | cg = pullop.remote.getbundle('pull', common=pullop.common, |
|
1694 | 1694 | heads=pullop.heads or pullop.rheads) |
|
1695 | 1695 | elif pullop.heads is None: |
|
1696 | cg = pullop.remote.changegroup(pullop.fetch, 'pull') | |
|
1696 | with pullop.remote.commandexecutor() as e: | |
|
1697 | cg = e.callcommand('changegroup', { | |
|
1698 | 'nodes': pullop.fetch, | |
|
1699 | 'source': 'pull', | |
|
1700 | }).result() | |
|
1701 | ||
|
1697 | 1702 | elif not pullop.remote.capable('changegroupsubset'): |
|
1698 | 1703 | raise error.Abort(_("partial pull cannot be done because " |
|
1699 | 1704 | "other repository doesn't support " |
|
1700 | 1705 | "changegroupsubset.")) |
|
1701 | 1706 | else: |
|
1702 | cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull') | |
|
1707 | with pullop.remote.commandexecutor() as e: | |
|
1708 | cg = e.callcommand('changegroupsubset', { | |
|
1709 | 'bases': pullop.fetch, | |
|
1710 | 'heads': pullop.heads, | |
|
1711 | 'source': 'pull', | |
|
1712 | }).result() | |
|
1713 | ||
|
1703 | 1714 | bundleop = bundle2.applybundle(pullop.repo, cg, tr, 'pull', |
|
1704 | 1715 | pullop.remote.url()) |
|
1705 | 1716 | pullop.cgresult = bundle2.combinechangegroupresults(bundleop) |
@@ -320,7 +320,8 b' class localpeer(repository.peer):' | |||
|
320 | 320 | |
|
321 | 321 | # End of peer interface. |
|
322 | 322 | |
|
323 | class locallegacypeer(repository.legacypeer, localpeer): | |
|
323 | @zi.implementer(repository.ipeerlegacycommands) | |
|
324 | class locallegacypeer(localpeer): | |
|
324 | 325 | '''peer extension which implements legacy methods too; used for tests with |
|
325 | 326 | restricted capabilities''' |
|
326 | 327 | |
@@ -335,8 +336,8 b' class locallegacypeer(repository.legacyp' | |||
|
335 | 336 | def branches(self, nodes): |
|
336 | 337 | return self._repo.branches(nodes) |
|
337 | 338 | |
|
338 |
def changegroup(self, |
|
|
339 |
outgoing = discovery.outgoing(self._repo, missingroots= |
|
|
339 | def changegroup(self, nodes, source): | |
|
340 | outgoing = discovery.outgoing(self._repo, missingroots=nodes, | |
|
340 | 341 | missingheads=self._repo.heads()) |
|
341 | 342 | return changegroup.makechangegroup(self._repo, outgoing, '01', source) |
|
342 | 343 |
@@ -190,10 +190,10 b' class ipeerlegacycommands(zi.Interface):' | |||
|
190 | 190 | Returns an iterable of iterables with the resolved values for each node. |
|
191 | 191 | """ |
|
192 | 192 | |
|
193 |
def changegroup(nodes, |
|
|
193 | def changegroup(nodes, source): | |
|
194 | 194 | """Obtain a changegroup with data for descendants of specified nodes.""" |
|
195 | 195 | |
|
196 |
def changegroupsubset(bases, heads, |
|
|
196 | def changegroupsubset(bases, heads, source): | |
|
197 | 197 | pass |
|
198 | 198 | |
|
199 | 199 | class ipeercommandexecutor(zi.Interface): |
@@ -285,9 +285,6 b' class ipeerbase(ipeerconnection, ipeerca' | |||
|
285 | 285 | All peer instances must conform to this interface. |
|
286 | 286 | """ |
|
287 | 287 | |
|
288 | class ipeerbaselegacycommands(ipeerbase, ipeerlegacycommands): | |
|
289 | """Unified peer interface that supports legacy commands.""" | |
|
290 | ||
|
291 | 288 | @zi.implementer(ipeerbase) |
|
292 | 289 | class peer(object): |
|
293 | 290 | """Base class for peer repositories.""" |
@@ -312,10 +309,6 b' class peer(object):' | |||
|
312 | 309 | _('cannot %s; remote repository does not support the %r ' |
|
313 | 310 | 'capability') % (purpose, name)) |
|
314 | 311 | |
|
315 | @zi.implementer(ipeerbaselegacycommands) | |
|
316 | class legacypeer(peer): | |
|
317 | """peer but with support for legacy wire protocol commands.""" | |
|
318 | ||
|
319 | 312 | class ifilerevisionssequence(zi.Interface): |
|
320 | 313 | """Contains index data for all revisions of a file. |
|
321 | 314 |
@@ -308,7 +308,8 b' class peerexecutor(object):' | |||
|
308 | 308 | else: |
|
309 | 309 | f.set_result(result) |
|
310 | 310 | |
|
311 | class wirepeer(repository.legacypeer): | |
|
311 | @zi.implementer(repository.ipeerlegacycommands) | |
|
312 | class wirepeer(repository.peer): | |
|
312 | 313 | """Client-side interface for communicating with a peer repository. |
|
313 | 314 | |
|
314 | 315 | Methods commonly call wire protocol commands of the same name. |
@@ -502,12 +503,12 b' class wirepeer(repository.legacypeer):' | |||
|
502 | 503 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
503 | 504 | return r |
|
504 | 505 | |
|
505 |
def changegroup(self, nodes, |
|
|
506 | def changegroup(self, nodes, source): | |
|
506 | 507 | n = wireprototypes.encodelist(nodes) |
|
507 | 508 | f = self._callcompressable("changegroup", roots=n) |
|
508 | 509 | return changegroupmod.cg1unpacker(f, 'UN') |
|
509 | 510 | |
|
510 |
def changegroupsubset(self, bases, heads, |
|
|
511 | def changegroupsubset(self, bases, heads, source): | |
|
511 | 512 | self.requirecap('changegroupsubset', _('look up remote changes')) |
|
512 | 513 | bases = wireprototypes.encodelist(bases) |
|
513 | 514 | heads = wireprototypes.encodelist(heads) |
@@ -89,8 +89,7 b' def main():' | |||
|
89 | 89 | |
|
90 | 90 | checkzobject(badpeer()) |
|
91 | 91 | |
|
92 |
ziverify.verifyClass(repository.ipeerbase |
|
|
93 | httppeer.httppeer) | |
|
92 | ziverify.verifyClass(repository.ipeerbase, httppeer.httppeer) | |
|
94 | 93 | checkzobject(httppeer.httppeer(None, None, None, dummyopener(), None, None)) |
|
95 | 94 | |
|
96 | 95 | ziverify.verifyClass(repository.ipeerconnection, |
@@ -111,13 +110,11 b' def main():' | |||
|
111 | 110 | wireprotov1peer.peerexecutor) |
|
112 | 111 | checkzobject(wireprotov1peer.peerexecutor(None)) |
|
113 | 112 | |
|
114 |
ziverify.verifyClass(repository.ipeerbase |
|
|
115 | sshpeer.sshv1peer) | |
|
113 | ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv1peer) | |
|
116 | 114 | checkzobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, dummypipe(), |
|
117 | 115 | dummypipe(), None, None)) |
|
118 | 116 | |
|
119 |
ziverify.verifyClass(repository.ipeerbase |
|
|
120 | sshpeer.sshv2peer) | |
|
117 | ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv2peer) | |
|
121 | 118 | checkzobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, dummypipe(), |
|
122 | 119 | dummypipe(), None, None)) |
|
123 | 120 |
General Comments 0
You need to be logged in to leave comments.
Login now