# HG changeset patch # User Pierre-Yves David # Date 1569376121 -7200 # Node ID 0b87eb2fba67c15a8c8af7c5074a17f52056aa9c # Parent 3518da5043032c41ade95e9e6832059e815abbbb copies: prepare changelog for more copies storage mode We want to store copies information in sidedata, the logic will be quite similar to the one used for extra, but sightly different (not in extra, no hash impact). We start with small refactoring to make our work easier and the coming changesets cleaners. Differential Revision: https://phab.mercurial-scm.org/D6936 diff -r 3518da504303 -r 0b87eb2fba67 mercurial/changelog.py --- a/mercurial/changelog.py Fri Sep 27 05:17:30 2019 +0200 +++ b/mercurial/changelog.py Wed Sep 25 03:48:41 2019 +0200 @@ -391,6 +391,7 @@ self._delaybuf = None self._divert = False self.filteredrevs = frozenset() + self._copiesstorage = opener.options.get('copies-storage') def tiprev(self): for i in pycompat.xrange(len(self) -1, -2, -1): @@ -633,21 +634,22 @@ elif branch in (".", "null", "tip"): raise error.StorageError(_('the name \'%s\' is reserved') % branch) - extrasentries = p1copies, p2copies, filesadded, filesremoved - if extra is None and any(x is not None for x in extrasentries): - extra = {} sortedfiles = sorted(files) if extra is not None: for name in ('p1copies', 'p2copies', 'filesadded', 'filesremoved'): extra.pop(name, None) - if p1copies is not None: - extra['p1copies'] = encodecopies(sortedfiles, p1copies) - if p2copies is not None: - extra['p2copies'] = encodecopies(sortedfiles, p2copies) - if filesadded is not None: - extra['filesadded'] = encodefileindices(sortedfiles, filesadded) - if filesremoved is not None: - extra['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) + if p2copies is not None: + extra['p2copies'] = encodecopies(sortedfiles, p2copies) + if filesadded is not None: + extra['filesadded'] = encodefileindices(sortedfiles, filesadded) + if filesremoved is not None: + extra['filesremoved'] = encodefileindices(sortedfiles, filesremoved) if extra: extra = encodeextra(extra) diff -r 3518da504303 -r 0b87eb2fba67 mercurial/localrepo.py --- a/mercurial/localrepo.py Fri Sep 27 05:17:30 2019 +0200 +++ b/mercurial/localrepo.py Wed Sep 25 03:48:41 2019 +0200 @@ -751,6 +751,11 @@ else: # explicitly mark repo as using revlogv0 options['revlogv0'] = True + writecopiesto = ui.config('experimental', 'copies.write-to') + copiesextramode = ('changeset-only', 'compatibility') + if (writecopiesto in copiesextramode): + options['copies-storage'] = 'extra' + return options def resolverevlogstorevfsoptions(ui, requirements, features):