[PATCH 07 of 11] commitctx: treat `filesadded` more like `filesremoved`
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Jul 24 14:38:32 UTC 2020
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1595538480 -7200
# Thu Jul 23 23:08:00 2020 +0200
# Node ID aa121e67dfaa9d793dcd375c16f91d21060f22fb
# Parent 4eeff7ebf46eb591767ca79fbceb447b2d3ca17d
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
# hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r aa121e67dfaa
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.
diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -94,7 +94,7 @@ def commitctx(repo, ctx, error=False, or
# check in files
added = []
- filesadded = []
+ files_added = []
removed = list(ctx.removed())
touched = []
linkrev = len(repo)
@@ -113,8 +113,8 @@ def commitctx(repo, ctx, error=False, or
)
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 @@ def commitctx(repo, ctx, error=False, or
if writechangesetcopy:
filesremoved = removed
+ filesadded = files_added
if not writefilecopymeta:
# If writing only to changeset extras, use None to indicate that
More information about the Mercurial-devel
mailing list