Patchwork [19,of,22] wireproto: use decorator for the lookup command

login
register
mail settings
Submitter Pierre-Yves David
Date March 28, 2014, 10:40 p.m.
Message ID <db8c9286ba8d7be9a91d.1396046445@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4139/
State Accepted
Commit 7fac25eddceab415c53081305a48484b089faa94
Headers show

Comments

Pierre-Yves David - March 28, 2014, 10:40 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1396042958 25200
#      Fri Mar 28 14:42:38 2014 -0700
# Node ID db8c9286ba8d7be9a91df430ea0bf8318c2c5385
# Parent  c9488d24e618813255e59bb7c2c406ac23ce50d5
wireproto: use decorator for the lookup command

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -626,10 +626,11 @@  def listkeys(repo, proto, namespace):
     d = repo.listkeys(encoding.tolocal(namespace)).items()
     t = '\n'.join(['%s\t%s' % (encoding.fromlocal(k), encoding.fromlocal(v))
                    for k, v in d])
     return t
 
+@wireprotocommand('lookup', 'key')
 def lookup(repo, proto, key):
     try:
         k = encoding.tolocal(key)
         c = repo[k]
         r = c.hex()
@@ -792,10 +793,9 @@  def unbundle(repo, proto, heads):
     finally:
         fp.close()
         os.unlink(tempname)
 
 commands.update({
-    'lookup': (lookup, 'key'),
     'pushkey': (pushkey, 'namespace key old new'),
     'stream_out': (stream, ''),
     'unbundle': (unbundle, 'heads'),
 })