Skip to content
Snippets Groups Projects
Commit 041f042afcc5 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

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
parent 0b87eb2fba67
No related branches found
No related tags found
No related merge requests found
......@@ -638,8 +638,16 @@
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:
......@@ -641,7 +649,7 @@
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:
......@@ -647,3 +655,3 @@
if p2copies is not None:
extra['p2copies'] = encodecopies(sortedfiles, p2copies)
extra['p2copies'] = p2copies
if filesadded is not None:
......@@ -649,3 +657,3 @@
if filesadded is not None:
extra['filesadded'] = encodefileindices(sortedfiles, filesadded)
extra['filesadded'] = filesadded
if filesremoved is not None:
......@@ -651,5 +659,5 @@
if filesremoved is not None:
extra['filesremoved'] = encodefileindices(sortedfiles, filesremoved)
extra['filesremoved'] = filesremoved
if extra:
extra = encodeextra(extra)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment