Patchwork wireproto: expose the list of getbundle argument to extensions

mail settings
Submitter Pierre-Yves David
Date May 27, 2014, 12:20 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/4865/
State Accepted
Headers show


Pierre-Yves David - May 27, 2014, 12:20 a.m.
# HG changeset patch
# User Pierre-Yves David <>
# 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/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -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(','))