Patchwork [09,of,11] commitctx: move a special case about files earlier

login
register
mail settings
Submitter Pierre-Yves David
Date July 24, 2020, 2:38 p.m.
Message ID <8bd4fa80f2550e94ab35.1595601514@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/46874/
State Accepted
Headers show

Comments

Pierre-Yves David - July 24, 2020, 2:38 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1595540459 -7200
#      Thu Jul 23 23:40:59 2020 +0200
# Node ID 8bd4fa80f2550e94ab3592ae6543649bf8af5449
# Parent  59f2136c091bc68c96fb56e7618128b77b62194e
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#              hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 8bd4fa80f255
commitctx: move a special case about files earlier

Same logic as a changeset a bit earlier, the `writefilecopymeta` section is more
a post processing details so we move the conditional about `files` value closer
to the rest of the code computing `files` value.

Patch

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -89,6 +89,9 @@  def commitctx(repo, ctx, error=False, or
                 filesremoved = removed
                 filesadded = added
 
+        if origctx and origctx.manifestnode() == mn:
+            files = origctx.files()
+
         if not writefilecopymeta:
             # If writing only to changeset extras, use None to indicate that
             # no entry should be written. If writing to both, write an empty
@@ -99,9 +102,6 @@  def commitctx(repo, ctx, error=False, or
             filesadded = filesadded or None
             filesremoved = filesremoved or None
 
-        if origctx and origctx.manifestnode() == mn:
-            files = origctx.files()
-
         # update changelog
         repo.ui.note(_(b"committing changelog\n"))
         repo.changelog.delayupdate(tr)