changeset 45235:b65b4b09859c

commitctx: treat `filesadded` more like `filesremoved` Accumulating the filename in a list will have a negligible cost and deal with the list of added files like the other ones will make is code cleaning simpler. The two variable with very close name is not great, but my plan is to split most of the code in a separated function which will make the "problem" go away by itself.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Jul 2020 23:08:00 +0200
parents 595307e14140
children 0c468fef09b3
files mercurial/commit.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commit.py	Thu Jul 23 22:58:29 2020 +0200
+++ b/mercurial/commit.py	Thu Jul 23 23:08:00 2020 +0200
@@ -94,7 +94,7 @@
 
             # check in files
             added = []
-            filesadded = []
+            files_added = []
             removed = list(ctx.removed())
             touched = []
             linkrev = len(repo)
@@ -113,8 +113,8 @@
                         )
                         if is_touched:
                             touched.append(f)
-                            if writechangesetcopy and is_touched == 'added':
-                                filesadded.append(f)
+                            if is_touched == 'added':
+                                files_added.append(f)
                         m.setflag(f, fctx.flags())
                 except OSError:
                     repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
@@ -143,6 +143,7 @@
 
             if writechangesetcopy:
                 filesremoved = removed
+                filesadded = files_added
 
         if not writefilecopymeta:
             # If writing only to changeset extras, use None to indicate that