Patchwork wireproto: expose the list of getbundle argument to extensions

login
register
mail settings
Submitter Pierre-Yves David
Date May 27, 2014, 12:20 a.m.
Message ID <41e1922963546136d647.1401150024@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4865/
State Accepted
Headers show

Comments

Pierre-Yves David - May 27, 2014, 12:20 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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(','))