Mercurial > public > mercurial-scm > hg
comparison hgext/uncommit.py @ 41340:c9f1fd82a826
uncommit: mark old node obsolete after updating dirstate
The next patch will start doing more things with the context object
for the old node and that ran into problems without this
change. Regardless of that, I think it seems better to first update to
the new node and then mark the old node obsolete.
Differential Revision: https://phab.mercurial-scm.org/D5660
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 20 Jan 2019 22:00:21 -0800 |
parents | 7be231f5a4ad |
children | 19c590ce8661 |
comparison
equal
deleted
inserted
replaced
41339:7be231f5a4ad | 41340:c9f1fd82a826 |
---|---|
177 mapping[old.node()] = (newid,) | 177 mapping[old.node()] = (newid,) |
178 else: | 178 else: |
179 # Fully removed the old commit | 179 # Fully removed the old commit |
180 mapping[old.node()] = () | 180 mapping[old.node()] = () |
181 | 181 |
182 scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True) | |
183 | |
184 with repo.dirstate.parentchange(): | 182 with repo.dirstate.parentchange(): |
185 repo.dirstate.setparents(newid, node.nullid) | 183 repo.dirstate.setparents(newid, node.nullid) |
186 s = old.p1().status(old, match=match) | 184 s = old.p1().status(old, match=match) |
187 _fixdirstate(repo, old, repo[newid], s) | 185 _fixdirstate(repo, old, repo[newid], s) |
186 | |
187 scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True) | |
188 | 188 |
189 def predecessormarkers(ctx): | 189 def predecessormarkers(ctx): |
190 """yields the obsolete markers marking the given changeset as a successor""" | 190 """yields the obsolete markers marking the given changeset as a successor""" |
191 for data in ctx.repo().obsstore.predecessors.get(ctx.node(), ()): | 191 for data in ctx.repo().obsstore.predecessors.get(ctx.node(), ()): |
192 yield obsutil.marker(ctx.repo(), data) | 192 yield obsutil.marker(ctx.repo(), data) |