changeset 43027:041f042afcc5

copies: move file input processsing early If we are to store the same kind of data outside of extra, we need to explicitly prepare them before that. On the long run, other storage (eg: sidedata) might use a different encoding to store this information, since the constraint from extra does not apply to it. Differential Revision: https://phab.mercurial-scm.org/D6937
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Sep 2019 03:58:46 +0200
parents 0b87eb2fba67
children 827cb4fe62a3
files mercurial/changelog.py
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Wed Sep 25 03:48:41 2019 +0200
+++ b/mercurial/changelog.py	Wed Sep 25 03:58:46 2019 +0200
@@ -638,18 +638,26 @@
         if extra is not None:
             for name in ('p1copies', 'p2copies', 'filesadded', 'filesremoved'):
                 extra.pop(name, None)
+        if p1copies is not None:
+            p1copies = encodecopies(sortedfiles, p1copies)
+        if p2copies is not None:
+            p2copies = encodecopies(sortedfiles, p2copies)
+        if filesadded is not None:
+            filesadded = encodefileindices(sortedfiles, filesadded)
+        if filesremoved is not None:
+            filesremoved = encodefileindices(sortedfiles, filesremoved)
         if self._copiesstorage == 'extra':
             extrasentries = p1copies, p2copies, filesadded, filesremoved
             if extra is None and any(x is not None for x in extrasentries):
                 extra = {}
             if p1copies is not None:
-                extra['p1copies'] = encodecopies(sortedfiles, p1copies)
+                extra['p1copies'] = p1copies
             if p2copies is not None:
-                extra['p2copies'] = encodecopies(sortedfiles, p2copies)
+                extra['p2copies'] = p2copies
             if filesadded is not None:
-                extra['filesadded'] = encodefileindices(sortedfiles, filesadded)
+                extra['filesadded'] = filesadded
             if filesremoved is not None:
-                extra['filesremoved'] = encodefileindices(sortedfiles, filesremoved)
+                extra['filesremoved'] = filesremoved
 
         if extra:
             extra = encodeextra(extra)