[PATCH 4 of 4] bundle2: Remove unused heads and common arguments to getbundle2partsgenerator functions

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Sep 24 22:59:10 CDT 2014



On 09/24/2014 07:56 PM, Mike Hommey wrote:
> # HG changeset patch
> # User Mike Hommey <mh at glandium.org>
> # Date 1411613656 -32400
> #      Thu Sep 25 11:54:16 2014 +0900
> # Node ID e36dcfe3f313c0183524050f32b74fc040182995
> # Parent  17baf7a6335c720094b1e4d1b2b2c9d9911b5ba5
> bundle2: Remove unused heads and common arguments to getbundle2partsgenerator functions

I had something a bit more radical in mind, heads and common should stop 
being passed explicitly at any of the bundle2 function. The first 
arguments would be bundler, repo, source, bundlecaps, and bundlecaps2. 
And the heads + common one would be passed through kwargs in all cases.
(so nothing in wrong in the patch, but the callling should change too as 
well as arguments order in getchangegrouppart)


Also, test-check-commit-hg says hi:

++ /home/marmoute/mercurial-testing/tests/test-check-commit-hg.t.err
@@ -22,5 +22,10 @@
    >        echo
    >   fi
    > done
+  Revision 3f3fcaa5cf78 does not comply to commit message rules
+  ------------------------------------------------------
+  6: summary line too long
+   bundle2: Remove unused heads and common arguments to 
getbundle2partsgenerator functions
+



ERROR: test-check-commit-hg.t output changed


> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -1035,28 +1035,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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list