From patchwork Thu Jan 16 01:21:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7899: merge: define updatedirstate a little earlier and reuse it From: phabricator X-Patchwork-Id: 44407 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 16 Jan 2020 01:21:55 +0000 martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D7899 AFFECTED FILES mercurial/merge.py CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -2507,7 +2507,8 @@ ### apply phase if not branchmerge: # just jump to the new rev fp1, fp2, xp1, xp2 = fp2, nullid, xp2, b'' - if not partial and not wc.isinmemory(): + updatedirstate = not partial and not wc.isinmemory() + if updatedirstate: repo.hook(b'preupdate', throw=True, parent1=xp1, parent2=xp2) # note that we're in the middle of an update repo.vfs.write(b'updatestate', p2.hex()) @@ -2553,7 +2554,6 @@ ) ) - updatedirstate = not partial and not wc.isinmemory() wantfiledata = updatedirstate and not branchmerge stats, getfiledata = applyupdates( repo, actions, wc, p2, overwrite, wantfiledata, labels=labels