comparison mercurial/wireproto.py @ 20908:ae4bf69c8068

wireproto: use decorator for the between command
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 28 Mar 2014 14:36:05 -0700
parents aedec880e095
children c8b9cbf55840
comparison
equal deleted inserted replaced
20907:aedec880e095 20908:ae4bf69c8068
511 if isinstance(result, ooberror): 511 if isinstance(result, ooberror):
512 return result 512 return result
513 res.append(escapearg(result)) 513 res.append(escapearg(result))
514 return ';'.join(res) 514 return ';'.join(res)
515 515
516 @wireprotocommand('between', 'pairs')
516 def between(repo, proto, pairs): 517 def between(repo, proto, pairs):
517 pairs = [decodelist(p, '-') for p in pairs.split(" ")] 518 pairs = [decodelist(p, '-') for p in pairs.split(" ")]
518 r = [] 519 r = []
519 for b in repo.between(pairs): 520 for b in repo.between(pairs):
520 r.append(encodelist(b) + "\n") 521 r.append(encodelist(b) + "\n")
780 finally: 781 finally:
781 fp.close() 782 fp.close()
782 os.unlink(tempname) 783 os.unlink(tempname)
783 784
784 commands.update({ 785 commands.update({
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'),
790 'changegroupsubset': (changegroupsubset, 'bases heads'), 790 'changegroupsubset': (changegroupsubset, 'bases heads'),