[PATCH] bundle2: remove heads and common arguments to getbundle parts generators

Mike Hommey mh at glandium.org
Wed Sep 24 23:33:00 CDT 2014


# HG changeset patch
# User Mike Hommey <mh at glandium.org>
# Date 1411613656 -32400
#      Thu Sep 25 11:54:16 2014 +0900
# Node ID e661ac94cce8e9a71cc058b63dacd1625655333a
# Parent  17baf7a6335c720094b1e4d1b2b2c9d9911b5ba5
bundle2: remove heads and common arguments to getbundle parts generators

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1016,18 +1016,20 @@ def getbundle(repo, source, heads=None, 
     for bcaps in bundlecaps:
         if bcaps.startswith('bundle2='):
             blob = urllib.unquote(bcaps[len('bundle2='):])
             b2caps.update(bundle2.decodecaps(blob))
     bundler = bundle2.bundle20(repo.ui, b2caps)
 
     for name in getbundle2partsorder:
         func = getbundle2partsmapping[name]
-        func(bundler, repo, source, heads=heads, common=common,
-             bundlecaps=bundlecaps, b2caps=b2caps, **kwargs)
+        kwargs['heads'] = heads
+        kwargs['common'] = common
+        func(bundler, repo, source, bundlecaps=bundlecaps, b2caps=b2caps,
+             **kwargs)
 
     return util.chunkbuffer(bundler.getchunks())
 
 @getbundle2partsgenerator('changegroup')
 def _getbundlechangegrouppart(bundler, repo, source, heads=None, common=None,
                               bundlecaps=None, b2caps=None, **kwargs):
     """add a changegroup part to the requested bundle"""
     cg = None
@@ -1035,28 +1037,28 @@ def _getbundlechangegrouppart(bundler, r
         # build changegroup bundle here.
         cg = changegroup.getchangegroup(repo, source, heads=heads,
                                         common=common, bundlecaps=bundlecaps)
 
     if cg:
         bundler.newpart('b2x:changegroup', data=cg.getchunks())
 
 @getbundle2partsgenerator('listkeys')
-def _getbundlelistkeysparts(bundler, repo, source, heads=None, common=None,
-                           bundlecaps=None, b2caps=None, **kwargs):
+def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
+                            b2caps=None, **kwargs):
     """add parts containing listkeys namespaces to the requested bundle"""
     listkeys = kwargs.get('listkeys', ())
     for namespace in listkeys:
         part = bundler.newpart('b2x:listkeys')
         part.addparam('namespace', namespace)
         keys = repo.listkeys(namespace).items()
         part.data = pushkey.encodekeys(keys)
 
 @getbundle2partsgenerator('obsmarkers')
-def _getbundleobsmarkerpart(bundler, repo, source, heads=None, common=None,
+def _getbundleobsmarkerpart(bundler, repo, source, heads=None,
                             bundlecaps=None, b2caps=None, **kwargs):
     """add an obsolescence markers part to the requested bundle"""
     if kwargs.get('obsmarkers', False):
         if heads is None:
             heads = repo.heads()
         subset = [c.node() for c in repo.set('::%ln', heads)]
         markers = repo.obsstore.relevantmarkers(subset)
         buildobsmarkerspart(bundler, markers)


More information about the Mercurial-devel mailing list