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.
--- 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