comparison mercurial/wireproto.py @ 20907:aedec880e095

wireproto: use decorator for the batch command
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 28 Mar 2014 14:35:36 -0700
parents 7a634b34fc91
children ae4bf69c8068
comparison
equal deleted inserted replaced
20906:7a634b34fc91 20907:aedec880e095
479 def register(func): 479 def register(func):
480 commands[name] = (func, args) 480 commands[name] = (func, args)
481 return func 481 return func
482 return register 482 return register
483 483
484 @wireprotocommand('batch', 'cmds *')
484 def batch(repo, proto, cmds, others): 485 def batch(repo, proto, cmds, others):
485 repo = repo.filtered("served") 486 repo = repo.filtered("served")
486 res = [] 487 res = []
487 for pair in cmds.split(';'): 488 for pair in cmds.split(';'):
488 op, args = pair.split(' ', 1) 489 op, args = pair.split(' ', 1)
779 finally: 780 finally:
780 fp.close() 781 fp.close()
781 os.unlink(tempname) 782 os.unlink(tempname)
782 783
783 commands.update({ 784 commands.update({
784 'batch': (batch, 'cmds *'),
785 'between': (between, 'pairs'), 785 'between': (between, 'pairs'),
786 'branchmap': (branchmap, ''), 786 'branchmap': (branchmap, ''),
787 'branches': (branches, 'nodes'), 787 'branches': (branches, 'nodes'),
788 'capabilities': (capabilities, ''), 788 'capabilities': (capabilities, ''),
789 'changegroup': (changegroup, 'roots'), 789 'changegroup': (changegroup, 'roots'),