commitctx: move a special case about files earlier
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 23 Jul 2020 23:40:59 +0200
changeset 45237 39f4ec4039a8
parent 45236 0c468fef09b3
child 45238 bd7515273fd6
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.
mercurial/commit.py
--- a/mercurial/commit.py	Thu Jul 23 18:25:45 2020 +0200
+++ b/mercurial/commit.py	Thu Jul 23 23:40:59 2020 +0200
@@ -89,6 +89,9 @@
                 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 @@
             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)