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