comparison mercurial/wireproto.py @ 20918:0971939f51aa

wireproto: use decorator for the known command
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 28 Mar 2014 14:42:06 -0700
parents 5ad151f8a3fa
children 0bb1882c85b0
comparison
equal deleted inserted replaced
20917:5ad151f8a3fa 20918:0971939f51aa
636 except Exception, inst: 636 except Exception, inst:
637 r = str(inst) 637 r = str(inst)
638 success = 0 638 success = 0
639 return "%s %s\n" % (success, r) 639 return "%s %s\n" % (success, r)
640 640
641 @wireprotocommand('known', 'nodes *')
641 def known(repo, proto, nodes, others): 642 def known(repo, proto, nodes, others):
642 return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes))) 643 return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes)))
643 644
644 def pushkey(repo, proto, namespace, key, old, new): 645 def pushkey(repo, proto, namespace, key, old, new):
645 # compatibility with pre-1.8 clients which were accidentally 646 # compatibility with pre-1.8 clients which were accidentally
790 finally: 791 finally:
791 fp.close() 792 fp.close()
792 os.unlink(tempname) 793 os.unlink(tempname)
793 794
794 commands.update({ 795 commands.update({
795 'known': (known, 'nodes *'),
796 'listkeys': (listkeys, 'namespace'), 796 'listkeys': (listkeys, 'namespace'),
797 'lookup': (lookup, 'key'), 797 'lookup': (lookup, 'key'),
798 'pushkey': (pushkey, 'namespace key old new'), 798 'pushkey': (pushkey, 'namespace key old new'),
799 'stream_out': (stream, ''), 799 'stream_out': (stream, ''),
800 'unbundle': (unbundle, 'heads'), 800 'unbundle': (unbundle, 'heads'),