Patchwork [3,of,5] commit: move salvaged calculation a bit earlier in the function

login
register
mail settings
Submitter Pulkit Goyal
Date Oct. 13, 2020, 7:33 a.m.
Message ID <236c4ba9f9b860334702.1602574409@workspace>
Download mbox | patch
Permalink /patch/47439/
State Accepted
Headers show

Comments

Pulkit Goyal - Oct. 13, 2020, 7:33 a.m.
# 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

Patch

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)