From patchwork Tue Oct 13 07:33:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 5] commit: move salvaged calculation a bit earlier in the function From: Pulkit Goyal <7895pulkit@gmail.com> X-Patchwork-Id: 47439 Message-Id: <236c4ba9f9b860334702.1602574409@workspace> To: mercurial-devel@mercurial-scm.org Date: Tue, 13 Oct 2020 13:03:29 +0530 # HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1602315731 -19800 # Sat Oct 10 13:12:11 2020 +0530 # Node ID 236c4ba9f9b8603347026975a4fcb97da75ade8f # Parent d3df36bcf4a885038d5df6302f18008945ce48e7 # EXP-Topic merge-newnode-final commit: move salvaged calculation a bit earlier in the function This helps us initialize mergestate before and now we can pass it into `_process_files()` instead of re-reading it there. Differential Revision: https://phab.mercurial-scm.org/D9192 diff --git a/mercurial/commit.py b/mercurial/commit.py --- a/mercurial/commit.py +++ b/mercurial/commit.py @@ -114,6 +114,8 @@ def _prepare_files(tr, ctx, error=False, p1 = ctx.p1() writechangesetcopy, writefilecopymeta = _write_copy_meta(repo) + ms = mergestate.mergestate.read(repo) + salvaged = _get_salvaged(repo, ms, ctx) if ctx.manifestnode(): # reuse an existing manifest revision @@ -140,8 +142,6 @@ def _prepare_files(tr, ctx, error=False, files.update_copies_from_p1(ctx.p1copies()) files.update_copies_from_p2(ctx.p2copies()) - ms = mergestate.mergestate.read(repo) - salvaged = _get_salvaged(ctx.repo(), ms, ctx) for s in salvaged: files.mark_salvaged(s)