From patchwork Mon May 18 22:10:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8569: merge: get mergestate from context instead of directly From: phabricator X-Patchwork-Id: 46355 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Mon, 18 May 2020 22:10:55 +0000 durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This causes `hg fix` (and probably others) to use the new in-memory mergestate object instead of the on-disk one, which may incidentally correct some defects. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8569 AFFECTED FILES mercurial/merge.py CHANGE DETAILS To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1182,9 +1182,8 @@ _prefetchfiles(repo, mctx, actions) updated, merged, removed = 0, 0, 0 - ms = mergestatemod.mergestate.clean( - repo, wctx.p1().node(), mctx.node(), labels - ) + ms = wctx.mergestate(clean=True) + ms.reset(wctx.p1().node(), mctx.node(), labels) # add ACTION_GET_OTHER_AND_STORE to mergestate for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]: @@ -1593,7 +1592,7 @@ if not overwrite: if len(pl) > 1: raise error.Abort(_(b"outstanding uncommitted merge")) - ms = mergestatemod.mergestate.read(repo) + ms = wc.mergestate() if ms.unresolvedcount(): raise error.Abort( _(b"outstanding merge conflicts"),