commit: move salvaged calculation a bit earlier in the function
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 10 Oct 2020 13:12:11 +0530
changeset 45706 b92887ce8db4
parent 45705 61454026fa04
child 45707 035302e6bb38
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
mercurial/commit.py
--- a/mercurial/commit.py	Sat Oct 10 12:53:35 2020 +0530
+++ b/mercurial/commit.py	Sat Oct 10 13:12:11 2020 +0530
@@ -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)