# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1569376726 -7200 # Wed Sep 25 03:58:46 2019 +0200 # Node ID 041f042afcc51dc94b7ab9ff101c3ec4be8380b7 # Parent 0b87eb2fba67c15a8c8af7c5074a17f52056aa9c 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 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)