# HG changeset patch # User Pierre-Yves David # Date 1429037977 14400 # Node ID 8f70b529cb0c06d67e5ee4e5486e18ceb696abf4 # Parent 88a36edefea5a0a3cd9ba14f5f5e03557c938288 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 -r 88a36edefea5 -r 8f70b529cb0c mercurial/exchange.py --- a/mercurial/exchange.py Tue Apr 14 14:07:35 2015 -0400 +++ b/mercurial/exchange.py Tue Apr 14 14:59:37 2015 -0400 @@ -1135,7 +1135,7 @@ # 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 @@ -1147,7 +1147,10 @@ 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