Patchwork [20,of,22] wireproto: use decorator for the pushkey command

login
register
mail settings
Submitter Pierre-Yves David
Date March 28, 2014, 10:40 p.m.
Message ID <d58ada30d934b5a5ca15.1396046446@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4140/
State Accepted
Commit 70ed3174ce6910c769806c9de39d280d04f19c05
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 1396042975 25200
#      Fri Mar 28 14:42:55 2014 -0700
# Node ID d58ada30d934b5a5ca155ffb06d377771e047e95
# Parent  db8c9286ba8d7be9a91df430ea0bf8318c2c5385
wireproto: use decorator for the pushkey command

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -642,10 +642,11 @@  def lookup(repo, proto, key):
 
 @wireprotocommand('known', 'nodes *')
 def known(repo, proto, nodes, others):
     return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes)))
 
+@wireprotocommand('pushkey', 'namespace key old new')
 def pushkey(repo, proto, namespace, key, old, new):
     # compatibility with pre-1.8 clients which were accidentally
     # sending raw binary nodes rather than utf-8-encoded hex
     if len(new) == 20 and new.encode('string-escape') != new:
         # looks like it could be a binary node
@@ -793,9 +794,8 @@  def unbundle(repo, proto, heads):
     finally:
         fp.close()
         os.unlink(tempname)
 
 commands.update({
-    'pushkey': (pushkey, 'namespace key old new'),
     'stream_out': (stream, ''),
     'unbundle': (unbundle, 'heads'),
 })