commitctx: compute files added from _filecommit returns
When possible, lets avoid recomputing the same information again.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8703
--- a/mercurial/localrepo.py Mon Jul 06 19:35:53 2020 +0200
+++ b/mercurial/localrepo.py Mon Jul 06 20:03:30 2020 +0200
@@ -3120,6 +3120,7 @@
# check in files
added = []
+ filesadded = []
changed = []
removed = list(ctx.removed())
linkrev = len(self)
@@ -3138,6 +3139,8 @@
)
if is_touched:
changed.append(f)
+ if writechangesetcopy and is_touched == 'added':
+ filesadded.append(f)
m.setflag(f, fctx.flags())
except OSError:
self.ui.warn(
@@ -3193,9 +3196,6 @@
)
if writechangesetcopy:
- filesadded = [
- f for f in changed if not (f in m1 or f in m2)
- ]
filesremoved = removed
else:
self.ui.debug(