mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
mutation: assume a land if the successor is public and op is blank
Summary: When computing the fate of a commit, if we find the immediate successor is the next visible commit, we return the operation of the mutation record for that single operation. If it's not available, we then look at whether or not the commit is public to decide between the fallbacks of `land` or `rewrite`. Unfortunately, not all land operations end up with a `land` op. In particular, obsmarkers created with pullcreatemarkers and then backfilled into mutation records have a blank operation, and so we show `rewrite` here when we should show `land`. Switch around how we calculate the fate. Compute a default operation of `rewrite` or `land`, based on the phase of the successor, and then use that if the successor is not the immediate successor, or if the recorded operation is blank. Reviewed By: mitrandir77 Differential Revision: D15061863 fbshipit-source-id: 753b0b58f84e653b40f9918f7ad3b3adfff359d8
This commit is contained in:
parent
a2131ea555
commit
78952d3298
@ -329,7 +329,7 @@ def fate(repo, node):
|
||||
happened to this node that resulted in one or more visible commits.
|
||||
"""
|
||||
clrev = repo.changelog.rev
|
||||
phasecache = repo._phasecache
|
||||
phase = repo._phasecache.phase
|
||||
fate = []
|
||||
if isobsolete(repo, node):
|
||||
for succset in successorssets(repo, node, closest=True):
|
||||
@ -339,20 +339,18 @@ def fate(repo, node):
|
||||
fate.append((succset, "split"))
|
||||
else:
|
||||
succ = succset[0]
|
||||
preds = None
|
||||
# Base the default operation name on the successor's phase
|
||||
if succ in repo and phase(repo, clrev(succ)) == phases.public:
|
||||
op = "land"
|
||||
else:
|
||||
op = "rewrite"
|
||||
# Try to find the real operation name.
|
||||
entry = lookup(repo, succ)
|
||||
if entry is not None:
|
||||
preds = entry.preds()
|
||||
op = entry.op()
|
||||
if preds is not None and node in preds:
|
||||
fate.append((succset, op))
|
||||
elif (
|
||||
succ in repo
|
||||
and phasecache.phase(repo, clrev(succ)) == phases.public
|
||||
):
|
||||
fate.append((succset, "land"))
|
||||
else:
|
||||
fate.append((succset, "rewrite"))
|
||||
if preds is not None and node in preds:
|
||||
op = entry.op() or op
|
||||
fate.append((succset, op))
|
||||
return fate
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user