Patchwork D9192: commit: move salvaged calculation a bit earlier in the function

login
register
mail settings
Submitter phabricator
Date Oct. 10, 2020, 8:41 a.m.
Message ID <differential-rev-PHID-DREV-efetrrm6ye5zagektoys-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47429/
State Superseded
Headers show

Comments

phabricator - Oct. 10, 2020, 8:41 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This helps us initialize mergestate before and now we can pass it into
  `_process_files()` instead of re-reading it there.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9192

AFFECTED FILES
  mercurial/commit.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -114,6 +114,8 @@ 
     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 @@ 
         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)