D6937: copies: move file input processsing early

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Oct 1 08:33:47 EDT 2019


marmoute created this revision.
marmoute added reviewers: martinvonz, durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6937

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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)



To: marmoute, martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list