[PATCH] wireproto: enable optional args for known() for future extensibility

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Wed May 25 01:26:19 CDT 2011


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1306252096 -7200
# Node ID 9d31f762cdf263329aa80e0b8d9ecc38a2b3bf44
# Parent  bb5cbc16349e47adc8f8300fed3c397e0f54f4ec
wireproto: enable optional args for known() for future extensibility

Firstly, I think we should do this for all new wire commands, just
to be on the safe side. So I want to get this into the 1.9 release.

Secondly, there actually is potential here that sometimes the server
can know that the number of its nodes which can possibly still be
undecided on the client is small. It might then just send them along
directly (cutting short the end game). This, however, requires
walking the graph on the server, which can be expensive, so for the
moment we're not actually doing it.

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -288,7 +288,7 @@
         success = 0
     return "%s %s\n" % (success, r)
 
-def known(repo, proto, nodes):
+def known(repo, proto, nodes, others):
     return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes)))
 
 def pushkey(repo, proto, namespace, key, old, new):
@@ -412,7 +412,7 @@
     'getbundle': (getbundle, '*'),
     'heads': (heads, ''),
     'hello': (hello, ''),
-    'known': (known, 'nodes'),
+    'known': (known, 'nodes *'),
     'listkeys': (listkeys, 'namespace'),
     'lookup': (lookup, 'key'),
     'pushkey': (pushkey, 'namespace key old new'),


More information about the Mercurial-devel mailing list