[PATCH 2 of 2] bundle2: add an 'idx' argument to the 'getbundle2partsgenerator'
Martin von Zweigbergk
martinvonz at google.com
Wed Apr 15 13:07:53 CDT 2015
These seem reasonable to me. I'll push them to the clowncopter.
On Tue, Apr 14, 2015 at 12:12 PM Pierre-Yves David <
pierre-yves.david at ens-lyon.org> wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1429037977 14400
> # Tue Apr 14 14:59:37 2015 -0400
> # Node ID c1a731ed65a77904df26631756884d3dd17b5035
> # Parent 2ec934ad3f7fdcdf389f99cceeac2bf59a80f705
> bundle2: add an 'idx' argument to the 'getbundle2partsgenerator'
>
> This argument let extensions control in what order bundle2 part are
> generated
> server side during a pull. This is useful to ensure the transaction is in a
> proper state before some actions or hooks happens.
>
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -1133,11 +1133,11 @@ getbundle2partsorder = []
> # Mapping between step name and function
> #
> # This exists to help extensions wrap steps if necessary
> getbundle2partsmapping = {}
>
> -def getbundle2partsgenerator(stepname):
> +def getbundle2partsgenerator(stepname, idx=None):
> """decorator for function generating bundle2 part for getbundle
>
> The function is added to the step -> function mapping and appended to
> the
> list of steps. Beware that decorated functions will be added in order
> (this may matter).
> @@ -1145,11 +1145,14 @@ def getbundle2partsgenerator(stepname):
> You can only use this decorator for new steps, if you want to wrap a
> step
> from an extension, attack the getbundle2partsmapping dictionary
> directly."""
> def dec(func):
> assert stepname not in getbundle2partsmapping
> getbundle2partsmapping[stepname] = func
> - getbundle2partsorder.append(stepname)
> + if idx is None:
> + getbundle2partsorder.append(stepname)
> + else:
> + getbundle2partsorder.insert(idx, stepname)
> return func
> return dec
>
> def getbundle(repo, source, heads=None, common=None, bundlecaps=None,
> **kwargs):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150415/60fdf859/attachment.html>
More information about the Mercurial-devel
mailing list