Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commit.py @ 46431:72f5280e33b6
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
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 19 Jan 2021 00:18:39 +0100 |
parents | 89a2afe31e82 |
children | 0903d6b9b1df |
comparison
equal
deleted
inserted
replaced
46430:0c95b59a89f1 | 46431:72f5280e33b6 |
---|---|
94 p2.node(), | 94 p2.node(), |
95 user, | 95 user, |
96 ctx.date(), | 96 ctx.date(), |
97 extra, | 97 extra, |
98 ) | 98 ) |
99 rev = repo[n].rev() | |
99 xp1, xp2 = p1.hex(), p2 and p2.hex() or b'' | 100 xp1, xp2 = p1.hex(), p2 and p2.hex() or b'' |
100 repo.hook( | 101 repo.hook( |
101 b'pretxncommit', | 102 b'pretxncommit', |
102 throw=True, | 103 throw=True, |
103 node=hex(n), | 104 node=hex(n), |
106 ) | 107 ) |
107 # set the new commit is proper phase | 108 # set the new commit is proper phase |
108 targetphase = subrepoutil.newcommitphase(repo.ui, ctx) | 109 targetphase = subrepoutil.newcommitphase(repo.ui, ctx) |
109 | 110 |
110 # prevent unmarking changesets as public on recommit | 111 # prevent unmarking changesets as public on recommit |
111 waspublic = oldtip == repo.changelog.tiprev() and not repo[n].phase() | 112 waspublic = oldtip == repo.changelog.tiprev() and not repo[rev].phase() |
112 | 113 |
113 if targetphase and not waspublic: | 114 if targetphase and not waspublic: |
114 # retract boundary do not alter parent changeset. | 115 # retract boundary do not alter parent changeset. |
115 # if a parent have higher the resulting phase will | 116 # if a parent have higher the resulting phase will |
116 # be compliant anyway | 117 # be compliant anyway |
117 # | 118 # |
118 # if minimal phase was 0 we don't need to retract anything | 119 # if minimal phase was 0 we don't need to retract anything |
119 phases.registernew(repo, tr, targetphase, [repo[n].rev()]) | 120 phases.registernew(repo, tr, targetphase, [rev]) |
120 return n | 121 return n |
121 | 122 |
122 | 123 |
123 def _prepare_files(tr, ctx, error=False, origctx=None): | 124 def _prepare_files(tr, ctx, error=False, origctx=None): |
124 repo = ctx.repo() | 125 repo = ctx.repo() |