From patchwork Mon Mar 11 23:17:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6117: uncommit: convert _fixdirstate() into _movedirstate() From: phabricator X-Patchwork-Id: 39224 Message-Id: <8bce69b18c7202e5f0dd09be9b705107@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Mon, 11 Mar 2019 23:17:32 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHGbf72e4c39f0b: uncommit: convert _fixdirstate() into _movedirstate() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6117?vs=14466&id=14470 REVISION DETAIL https://phab.mercurial-scm.org/D6117 AFFECTED FILES hgext/uncommit.py CHANGE DETAILS To: martinvonz, #hg-reviewers, pulkit Cc: taapas1128, mercurial-devel diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -99,10 +99,9 @@ extra=ctx.extra()) return repo.commitctx(new) -def _fixdirstate(repo, oldctx, newctx, match=None): - """ fix the dirstate after switching the working directory from oldctx to - newctx which can be result of either unamend or uncommit. - """ +def _movedirstate(repo, newctx, match=None): + """Move the dirstate to newctx and adjust it as necessary.""" + oldctx = repo['.'] ds = repo.dirstate ds.setparents(newctx.node(), node.nullid) copies = dict(ds.copies()) @@ -194,7 +193,7 @@ mapping[old.node()] = () with repo.dirstate.parentchange(): - _fixdirstate(repo, old, repo[newid], match) + _movedirstate(repo, repo[newid], match) scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True) @@ -256,7 +255,7 @@ dirstate = repo.dirstate with dirstate.parentchange(): - _fixdirstate(repo, curctx, newpredctx) + _movedirstate(repo, newpredctx) mapping = {curctx.node(): (newprednode,)} scmutil.cleanupnodes(repo, mapping, 'unamend', fixphase=True)