Show More
@@ -69,20 +69,10 b' def getdispatchrepo(repo, proto, command' | |||
|
69 | 69 | def dispatch(repo, proto, command): |
|
70 | 70 | repo = getdispatchrepo(repo, proto, command) |
|
71 | 71 | |
|
72 | transportversion = wireprototypes.TRANSPORTS[proto.name]['version'] | |
|
73 | commandtable = commandsv2 if transportversion == 2 else commands | |
|
74 | func, spec = commandtable[command] | |
|
75 | ||
|
72 | func, spec = commands[command] | |
|
76 | 73 | args = proto.getargs(spec) |
|
77 | 74 | |
|
78 | # Version 1 protocols define arguments as a list. Version 2 uses a dict. | |
|
79 | if isinstance(args, list): | |
|
80 | 75 |
|
|
81 | elif isinstance(args, dict): | |
|
82 | return func(repo, proto, **args) | |
|
83 | else: | |
|
84 | raise error.ProgrammingError('unexpected type returned from ' | |
|
85 | 'proto.getargs(): %s' % type(args)) | |
|
86 | 76 | |
|
87 | 77 | def options(cmd, keys, others): |
|
88 | 78 | opts = {} |
@@ -296,7 +296,7 b' def _httpv2runcommand(ui, repo, req, res' | |||
|
296 | 296 | res.setbodybytes(_('command in frame must match command in URL')) |
|
297 | 297 | return True |
|
298 | 298 | |
|
299 |
rsp = |
|
|
299 | rsp = dispatch(repo, proto, command['command']) | |
|
300 | 300 | |
|
301 | 301 | res.status = b'200 OK' |
|
302 | 302 | res.headers[b'Content-Type'] = FRAMINGTYPE |
@@ -328,6 +328,17 b' def _httpv2runcommand(ui, repo, req, res' | |||
|
328 | 328 | raise error.ProgrammingError('unhandled event from reactor: %s' % |
|
329 | 329 | action) |
|
330 | 330 | |
|
331 | def getdispatchrepo(repo, proto, command): | |
|
332 | return repo.filtered('served') | |
|
333 | ||
|
334 | def dispatch(repo, proto, command): | |
|
335 | repo = getdispatchrepo(repo, proto, command) | |
|
336 | ||
|
337 | func, spec = wireproto.commandsv2[command] | |
|
338 | args = proto.getargs(spec) | |
|
339 | ||
|
340 | return func(repo, proto, **args) | |
|
341 | ||
|
331 | 342 | @zi.implementer(wireprototypes.baseprotocolhandler) |
|
332 | 343 | class httpv2protocolhandler(object): |
|
333 | 344 | def __init__(self, req, ui, args=None): |
General Comments 0
You need to be logged in to leave comments.
Login now