changeset 45326:99614011892b

commitctx: directly gather p1 and p2 copies in `files` The only thing we do with the p1copies and p2copies is to pass them around, we we can gather them later and directly stored them in the `ChangingFiles` object.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 25 Jul 2020 16:07:38 +0200
parents c6eea5804551
children 6de4c5647db3
files mercurial/commit.py
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commit.py	Sat Jul 25 16:02:26 2020 +0200
+++ b/mercurial/commit.py	Sat Jul 25 16:07:38 2020 +0200
@@ -115,10 +115,6 @@
 
     writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
 
-    p1copies, p2copies = None, None
-    if writechangesetcopy:
-        p1copies = ctx.p1copies()
-        p2copies = ctx.p2copies()
     filesadded, filesremoved = None, None
     if ctx.manifestnode():
         # reuse an existing manifest revision
@@ -144,10 +140,9 @@
     files = metadata.ChangingFiles()
     if touched:
         files.update_touched(touched)
-    if p1copies:
-        files.update_copies_from_p1(p1copies)
-    if p2copies:
-        files.update_copies_from_p2(p2copies)
+    if writechangesetcopy:
+        files.update_copies_from_p1(ctx.p1copies())
+        files.update_copies_from_p2(ctx.p2copies())
     if filesadded:
         files.update_added(filesadded)
     if filesremoved: