##// END OF EJS Templates
uncommit: convert _fixdirstate() into _movedirstate()...
Martin von Zweigbergk -
r42101:bf72e4c3 default
parent child Browse files
Show More
@@ -99,10 +99,9 b' def _commitfiltered(repo, ctx, match, ke'
99 extra=ctx.extra())
99 extra=ctx.extra())
100 return repo.commitctx(new)
100 return repo.commitctx(new)
101
101
102 def _fixdirstate(repo, oldctx, newctx, match=None):
102 def _movedirstate(repo, newctx, match=None):
103 """ fix the dirstate after switching the working directory from oldctx to
103 """Move the dirstate to newctx and adjust it as necessary."""
104 newctx which can be result of either unamend or uncommit.
104 oldctx = repo['.']
105 """
106 ds = repo.dirstate
105 ds = repo.dirstate
107 ds.setparents(newctx.node(), node.nullid)
106 ds.setparents(newctx.node(), node.nullid)
108 copies = dict(ds.copies())
107 copies = dict(ds.copies())
@@ -194,7 +193,7 b' def uncommit(ui, repo, *pats, **opts):'
194 mapping[old.node()] = ()
193 mapping[old.node()] = ()
195
194
196 with repo.dirstate.parentchange():
195 with repo.dirstate.parentchange():
197 _fixdirstate(repo, old, repo[newid], match)
196 _movedirstate(repo, repo[newid], match)
198
197
199 scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True)
198 scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True)
200
199
@@ -256,7 +255,7 b' def unamend(ui, repo, **opts):'
256 dirstate = repo.dirstate
255 dirstate = repo.dirstate
257
256
258 with dirstate.parentchange():
257 with dirstate.parentchange():
259 _fixdirstate(repo, curctx, newpredctx)
258 _movedirstate(repo, newpredctx)
260
259
261 mapping = {curctx.node(): (newprednode,)}
260 mapping = {curctx.node(): (newprednode,)}
262 scmutil.cleanupnodes(repo, mapping, 'unamend', fixphase=True)
261 scmutil.cleanupnodes(repo, mapping, 'unamend', fixphase=True)
General Comments 0
You need to be logged in to leave comments. Login now