mercurial/scmutil.py
changeset 38432 05b7dd11918e
parent 38423 32fba6fe893d
child 38456 1cac2e8c7624
--- a/mercurial/scmutil.py	Sat Jun 16 18:36:25 2018 +0530
+++ b/mercurial/scmutil.py	Thu Jun 21 08:22:11 2018 -0700
@@ -842,13 +842,13 @@
             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])
-                parentphase = max(phase(p) for p in ctx.parents())
                 newphase = max(oldphase, parentphase)
             else:
-                newphase = targetphase
+                newphase = max(targetphase, parentphase)
             newphases[newnode] = newphase
             if newphase > ctx.phase():
                 toretract.setdefault(newphase, []).append(newnode)