Skip to content
Snippets Groups Projects
Commit 05b7dd11 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

cleanupnodes: preserve phase of parents of new nodes

As Yuya noted in the review of D3818, passing in
targetphase=phases.draft would result in advancing the phase boundary
of a secret-phase parent. We never pass targetphase=phases.draft so
far, but it's a bug waiting to happen.

I tried to refactor it so max(parentphase, X) happened in one place,
but I couldn't come up with good variables names and I ended up with a
"newphase = max(newphase, parentphase)" line, which made the whole
block not look any better to me.

Differential Revision: https://phab.mercurial-scm.org/D3824
parent d6686f86
No related branches found
No related tags found
No related merge requests found
......@@ -842,6 +842,7 @@
return newphases.get(ctx.node(), ctx.phase())
for newnode in allnewnodes:
ctx = unfi[newnode]
parentphase = max(phase(p) for p in ctx.parents())
if targetphase is None:
oldphase = max(unfi[oldnode].phase()
for oldnode in precursors[newnode])
......@@ -845,6 +846,5 @@
if targetphase is None:
oldphase = max(unfi[oldnode].phase()
for oldnode in precursors[newnode])
parentphase = max(phase(p) for p in ctx.parents())
newphase = max(oldphase, parentphase)
else:
......@@ -849,6 +849,6 @@
newphase = max(oldphase, parentphase)
else:
newphase = targetphase
newphase = max(targetphase, parentphase)
newphases[newnode] = newphase
if newphase > ctx.phase():
toretract.setdefault(newphase, []).append(newnode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment