# HG changeset patch # User Joerg Sonnenberger # Date 2021-01-18 23:18:39 # Node ID 72f5280e33b6c3ec621ca33e2ac3de982e20a00a # Parent 0c95b59a89f17aabb202e1f1502b311f6b854d3b commit: look-up new revision once Look-up by node is slightly more expensive, so since it is necessary more than once, do it explicitly. Differential Revision: https://phab.mercurial-scm.org/D9830 diff --git a/mercurial/commit.py b/mercurial/commit.py --- a/mercurial/commit.py +++ b/mercurial/commit.py @@ -96,6 +96,7 @@ def commitctx(repo, ctx, error=False, or ctx.date(), extra, ) + rev = repo[n].rev() xp1, xp2 = p1.hex(), p2 and p2.hex() or b'' repo.hook( b'pretxncommit', @@ -108,7 +109,7 @@ def commitctx(repo, ctx, error=False, or targetphase = subrepoutil.newcommitphase(repo.ui, ctx) # prevent unmarking changesets as public on recommit - waspublic = oldtip == repo.changelog.tiprev() and not repo[n].phase() + waspublic = oldtip == repo.changelog.tiprev() and not repo[rev].phase() if targetphase and not waspublic: # retract boundary do not alter parent changeset. @@ -116,7 +117,7 @@ def commitctx(repo, ctx, error=False, or # be compliant anyway # # if minimal phase was 0 we don't need to retract anything - phases.registernew(repo, tr, targetphase, [repo[n].rev()]) + phases.registernew(repo, tr, targetphase, [rev]) return n