Mercurial > hg
diff mercurial/localrepo.py @ 43142:beed7ce61681
sidedatacopies: write copies information in sidedata when applicable
If the format of the repository indicate it stores copies information into
changeset's sidedata, then we actually write that information into sidedata at
commit time. It will be put to use in later changesets.
Currently, we store all field unconditionally, but that is likely to change in
the future for the sake of efficiency.
Differential Revision: https://phab.mercurial-scm.org/D6950
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 06 Oct 2019 23:36:51 -0400 |
parents | 81efc4a295e7 |
children | bca9d1a6c4c5 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sun Oct 06 23:36:51 2019 -0400 +++ b/mercurial/localrepo.py Sun Oct 06 23:36:51 2019 -0400 @@ -825,10 +825,13 @@ else: # explicitly mark repo as using revlogv0 options[b'revlogv0'] = True - writecopiesto = ui.config(b'experimental', b'copies.write-to') - copiesextramode = (b'changeset-only', b'compatibility') - if writecopiesto in copiesextramode: - options[b'copies-storage'] = b'extra' + if COPIESSDC_REQUIREMENT in requirements: + options[b'copies-storage'] = b'changeset-sidedata' + else: + writecopiesto = ui.config(b'experimental', b'copies.write-to') + copiesextramode = (b'changeset-only', b'compatibility') + if writecopiesto in copiesextramode: + options[b'copies-storage'] = b'extra' return options @@ -1182,6 +1185,10 @@ self._extrafilterid = repoview.extrafilter(ui) + self.filecopiesmode = None + if COPIESSDC_REQUIREMENT in self.requirements: + self.filecopiesmode = b'changeset-sidedata' + def _getvfsward(self, origfunc): """build a ward for self.vfs""" rref = weakref.ref(self) @@ -2949,12 +2956,17 @@ p1, p2 = ctx.p1(), ctx.p2() user = ctx.user() - writecopiesto = self.ui.config(b'experimental', b'copies.write-to') - writefilecopymeta = writecopiesto != b'changeset-only' - writechangesetcopy = writecopiesto in ( - b'changeset-only', - b'compatibility', - ) + if self.filecopiesmode == b'changeset-sidedata': + writechangesetcopy = True + writefilecopymeta = True + writecopiesto = None + else: + writecopiesto = self.ui.config(b'experimental', b'copies.write-to') + writefilecopymeta = writecopiesto != b'changeset-only' + writechangesetcopy = writecopiesto in ( + b'changeset-only', + b'compatibility', + ) p1copies, p2copies = None, None if writechangesetcopy: p1copies = ctx.p1copies()