[PATCH] wireproto: expose the list of getbundle argument to extensions

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Mon May 26 19:20:24 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1400748552 25200
#      Thu May 22 01:49:12 2014 -0700
# Node ID 41e1922963546136d647d9dd43d3a20730b5527d
# Parent  61151f429a5f93bafe184890e19a0399a690a2b8
wireproto: expose the list of getbundle argument to extensions

For now, getbundle accepts a fixed number of argument: ``heads``, ``common`` and
``bundlecaps``. We make this list of arguments exposed at the module level to
lets extensions adds content there. This is important for extension that wish to
use bundle2 for other contents than changegroup.

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -617,13 +617,19 @@ def changegroupsubset(repo, proto, bases
 def debugwireargs(repo, proto, one, two, others):
     # only accept optional args from the known set
     opts = options('debugwireargs', ['three', 'four'], others)
     return repo.debugwireargs(one, two, **opts)
 
+# list of options accepted by getbundle.
+#
+# Meant to be extended by extensions. It is extensions responsability to unsure
+# such option are properly processed in exchange.getbundle.
+gboptslist = ['heads', 'common', 'bundlecaps']
+
 @wireprotocommand('getbundle', '*')
 def getbundle(repo, proto, others):
-    opts = options('getbundle', ['heads', 'common', 'bundlecaps'], others)
+    opts = options('getbundle', gboptslist, others)
     for k, v in opts.iteritems():
         if k in ('heads', 'common'):
             opts[k] = decodelist(v)
         elif k == 'bundlecaps':
             opts[k] = set(v.split(','))


More information about the Mercurial-devel mailing list