mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
bundle2: add an 'idx' argument to the 'b2partsgenerator'
This argument let extensions control in what order bundle2 part are generated client side during a push. This is useful to ensure the transaction is in a proper state before some actions or hooks happens.
This commit is contained in:
parent
8561ae6b39
commit
ff78e38dd6
@ -427,7 +427,7 @@ b2partsgenorder = []
|
|||||||
# This exists to help extensions wrap steps if necessary
|
# This exists to help extensions wrap steps if necessary
|
||||||
b2partsgenmapping = {}
|
b2partsgenmapping = {}
|
||||||
|
|
||||||
def b2partsgenerator(stepname):
|
def b2partsgenerator(stepname, idx=None):
|
||||||
"""decorator for function generating bundle2 part
|
"""decorator for function generating bundle2 part
|
||||||
|
|
||||||
The function is added to the step -> function mapping and appended to the
|
The function is added to the step -> function mapping and appended to the
|
||||||
@ -439,7 +439,10 @@ def b2partsgenerator(stepname):
|
|||||||
def dec(func):
|
def dec(func):
|
||||||
assert stepname not in b2partsgenmapping
|
assert stepname not in b2partsgenmapping
|
||||||
b2partsgenmapping[stepname] = func
|
b2partsgenmapping[stepname] = func
|
||||||
b2partsgenorder.append(stepname)
|
if idx is None:
|
||||||
|
b2partsgenorder.append(stepname)
|
||||||
|
else:
|
||||||
|
b2partsgenorder.insert(idx, stepname)
|
||||||
return func
|
return func
|
||||||
return dec
|
return dec
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user