comparison mercurial/wireproto.py @ 13720:9c4e04fe267e

debug: add debugwireargs to test argument passing over the wire Tests argument passing locally, via HTTP, and via SSH. This is mainly preparation for the next patch.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Tue, 22 Mar 2011 07:38:32 +0100
parents b3f9af7c22c5
children 3458c15ab2f0
comparison
equal deleted inserted replaced
13719:cc9bf81382f5 13720:9c4e04fe267e
130 _('push failed (unexpected response):'), ret) 130 _('push failed (unexpected response):'), ret)
131 131
132 for l in output.splitlines(True): 132 for l in output.splitlines(True):
133 self.ui.status(_('remote: '), l) 133 self.ui.status(_('remote: '), l)
134 return ret 134 return ret
135
136 def debugwireargs(self, one, two, three=None, four=None):
137 # don't pass optional arguments left at their default value
138 opts = {}
139 if three is not None:
140 opts['three'] = three
141 if four is not None:
142 opts['four'] = four
143 return self._call('debugwireargs', one=one, two=two, **opts)
135 144
136 # server side 145 # server side
137 146
138 class streamres(object): 147 class streamres(object):
139 def __init__(self, gen): 148 def __init__(self, gen):
197 bases = decodelist(bases) 206 bases = decodelist(bases)
198 heads = decodelist(heads) 207 heads = decodelist(heads)
199 cg = repo.changegroupsubset(bases, heads, 'serve') 208 cg = repo.changegroupsubset(bases, heads, 'serve')
200 return streamres(proto.groupchunks(cg)) 209 return streamres(proto.groupchunks(cg))
201 210
211 def debugwireargs(repo, proto, one, two):
212 return repo.debugwireargs(one, two)
213
202 def heads(repo, proto): 214 def heads(repo, proto):
203 h = repo.heads() 215 h = repo.heads()
204 return encodelist(h) + "\n" 216 return encodelist(h) + "\n"
205 217
206 def hello(repo, proto): 218 def hello(repo, proto):
341 'branchmap': (branchmap, ''), 353 'branchmap': (branchmap, ''),
342 'branches': (branches, 'nodes'), 354 'branches': (branches, 'nodes'),
343 'capabilities': (capabilities, ''), 355 'capabilities': (capabilities, ''),
344 'changegroup': (changegroup, 'roots'), 356 'changegroup': (changegroup, 'roots'),
345 'changegroupsubset': (changegroupsubset, 'bases heads'), 357 'changegroupsubset': (changegroupsubset, 'bases heads'),
358 'debugwireargs': (debugwireargs, 'one two'),
346 'heads': (heads, ''), 359 'heads': (heads, ''),
347 'hello': (hello, ''), 360 'hello': (hello, ''),
348 'listkeys': (listkeys, 'namespace'), 361 'listkeys': (listkeys, 'namespace'),
349 'lookup': (lookup, 'key'), 362 'lookup': (lookup, 'key'),
350 'pushkey': (pushkey, 'namespace key old new'), 363 'pushkey': (pushkey, 'namespace key old new'),