mercurial/commit.py
changeset 45251 0041a42c6f28
parent 45250 efe8a67793b6
child 45323 aea6a812f7cb
--- a/mercurial/commit.py	Sat Jul 25 15:33:45 2020 +0200
+++ b/mercurial/commit.py	Sat Jul 25 15:37:05 2020 +0200
@@ -149,16 +149,6 @@
     if origctx and origctx.manifestnode() == mn:
         touched = 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
-        # entry to prevent the reader from falling back to reading
-        # filelogs.
-        p1copies = p1copies or None
-        p2copies = p2copies or None
-        filesadded = filesadded or None
-        filesremoved = filesremoved or None
-
     return mn, touched, p1copies, p2copies, filesadded, filesremoved
 
 
@@ -427,6 +417,16 @@
     repo, extra, files, p1copies, p2copies, filesadded, filesremoved
 ):
     """encode copy information into a `extra` dictionnary"""
+    if not _write_copy_meta(repo)[1]:
+        # If writing only to changeset extras, use None to indicate that
+        # no entry should be written. If writing to both, write an empty
+        # entry to prevent the reader from falling back to reading
+        # filelogs.
+        p1copies = p1copies or None
+        p2copies = p2copies or None
+        filesadded = filesadded or None
+        filesremoved = filesremoved or None
+
     extrasentries = p1copies, p2copies, filesadded, filesremoved
     if extra is None and any(x is not None for x in extrasentries):
         extra = {}