mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
pushrebase use hookargs correctly if transaction was taken
Summary: Context: for Mononoke sync job we are considering applying a few pushrebase bundles under the same transaction to make sync job faster. More details - https://fburl.com/y4we86hc Doing two pushrebases under the same transaction seems to fail for just one reason - `hookargs` is None on the second bundle. The reason is this line - https://fburl.com/y4we86hc, after gettransaction() is called bundleoperation.hookargs is set to None, but transaction.hookargs is set to current hookargs value. In this diff pushrebase is changed to check both bundleoperation.hookargs and transaction.hookargs Reviewed By: quark-zju Differential Revision: D14930970 fbshipit-source-id: e4a4dd1c85b1fdca2699dd431040d65f2642ec8a
This commit is contained in:
parent
f337e0d5e4
commit
e1e5d4bb0d
@ -1328,7 +1328,23 @@ def prepushrebasehooks(op, params, bundle, bundlefile):
|
|||||||
prelockontonode = prelockonto.hex() if prelockonto else None
|
prelockontonode = prelockonto.hex() if prelockonto else None
|
||||||
|
|
||||||
# Allow running hooks on the new commits before we take the lock
|
# Allow running hooks on the new commits before we take the lock
|
||||||
prelockrebaseargs = op.hookargs.copy()
|
if op.hookargs is None:
|
||||||
|
# Usually pushrebase prepushrebasehooks are called outside of
|
||||||
|
# transaction. If that's the case then op.hookargs is not None and
|
||||||
|
# it contains hook arguments.
|
||||||
|
# However Mononoke -> hg sync job might replay two bundles under
|
||||||
|
# the same transaction. In that case hookargs are stored in transaction
|
||||||
|
# object (see bundle2operation:gettransaction).
|
||||||
|
#
|
||||||
|
# For reference: Mononoke -> hg sync job uses wireproto.py:unbundlereplay
|
||||||
|
# function as it's entry point
|
||||||
|
tr = op.repo.currenttransaction()
|
||||||
|
if tr is not None:
|
||||||
|
prelockrebaseargs = tr.hookargs.copy()
|
||||||
|
else:
|
||||||
|
raise error.ProgrammingError("internal error: hookargs are not set")
|
||||||
|
else:
|
||||||
|
prelockrebaseargs = op.hookargs.copy()
|
||||||
prelockrebaseargs["source"] = "push"
|
prelockrebaseargs["source"] = "push"
|
||||||
prelockrebaseargs["bundle2"] = "1"
|
prelockrebaseargs["bundle2"] = "1"
|
||||||
prelockrebaseargs["node"] = scmutil.revsingle(bundle, "min(bundle())").hex()
|
prelockrebaseargs["node"] = scmutil.revsingle(bundle, "min(bundle())").hex()
|
||||||
|
Loading…
Reference in New Issue
Block a user