comparison mercurial/wireproto.py @ 20912:96ecb77f971d

wireproto: use decorator for the changegroup command
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 28 Mar 2014 14:38:19 -0700
parents 1bb8ed6c000c
children fc7219ec08bb
comparison
equal deleted inserted replaced
20911:1bb8ed6c000c 20912:96ecb77f971d
573 # `_capabilities` instead. 573 # `_capabilities` instead.
574 @wireprotocommand('capabilities') 574 @wireprotocommand('capabilities')
575 def capabilities(repo, proto): 575 def capabilities(repo, proto):
576 return ' '.join(_capabilities(repo, proto)) 576 return ' '.join(_capabilities(repo, proto))
577 577
578 @wireprotocommand('changegroup', 'roots')
578 def changegroup(repo, proto, roots): 579 def changegroup(repo, proto, roots):
579 nodes = decodelist(roots) 580 nodes = decodelist(roots)
580 cg = repo.changegroup(nodes, 'serve') 581 cg = repo.changegroup(nodes, 'serve')
581 return streamres(proto.groupchunks(cg)) 582 return streamres(proto.groupchunks(cg))
582 583
784 finally: 785 finally:
785 fp.close() 786 fp.close()
786 os.unlink(tempname) 787 os.unlink(tempname)
787 788
788 commands.update({ 789 commands.update({
789 'changegroup': (changegroup, 'roots'),
790 'changegroupsubset': (changegroupsubset, 'bases heads'), 790 'changegroupsubset': (changegroupsubset, 'bases heads'),
791 'debugwireargs': (debugwireargs, 'one two *'), 791 'debugwireargs': (debugwireargs, 'one two *'),
792 'getbundle': (getbundle, '*'), 792 'getbundle': (getbundle, '*'),
793 'heads': (heads, ''), 793 'heads': (heads, ''),
794 'hello': (hello, ''), 794 'hello': (hello, ''),