Mercurial > hg
changeset 43026:0b87eb2fba67
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 25 Sep 2019 03:48:41 +0200 |
parents | 3518da504303 |
children | 041f042afcc5 |
files | mercurial/changelog.py mercurial/localrepo.py |
diffstat | 2 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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):