wireproto: enable optional args for known() for future extensibility
authorPeter Arrenbrecht <peter.arrenbrecht@gmail.com>
Tue, 24 May 2011 17:48:16 +0200
changeset 14436 5adb52524779
parent 14435 5f6090e559fa
child 14437 cbe13e6bdc34
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.
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Thu May 26 17:15:35 2011 -0500
+++ b/mercurial/wireproto.py	Tue May 24 17:48:16 2011 +0200
@@ -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'),