Mercurial > public > mercurial-scm > hg-stable
diff mercurial/upgrade.py @ 46017:705c37f22859
upgrade: add support for experimental safe share mode
Recently we introduce the share-safe functionality which makes shares share
requirements and config of share source. This patch adds support to
`debugupgraderepo` command to upgrade repository to share-safe mode when
`format.exp-share-safe` config is enabled.
Differential Revision: https://phab.mercurial-scm.org/D9144
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 25 Jun 2020 13:13:21 +0530 |
parents | 7c539f0febbe |
children | c6a1fa42e325 |
line wrap: on
line diff
--- a/mercurial/upgrade.py Mon Nov 30 14:11:03 2020 +0530 +++ b/mercurial/upgrade.py Thu Jun 25 13:13:21 2020 +0530 @@ -137,6 +137,7 @@ requirements.SIDEDATA_REQUIREMENT, requirements.COPIESSDC_REQUIREMENT, requirements.NODEMAP_REQUIREMENT, + requirements.SHARESAFE_REQUIREMENT, } for name in compression.compengines: engine = compression.compengines[name] @@ -337,6 +338,26 @@ @registerformatvariant +class sharedsafe(requirementformatvariant): + name = b'exp-sharesafe' + _requirement = requirements.SHARESAFE_REQUIREMENT + + default = False + + description = _( + b'old shared repositories do not share source repository ' + b'requirements and config. This leads to various problems ' + b'when the source repository format is upgraded or some new ' + b'extensions are enabled.' + ) + + upgrademessage = _( + b'Upgrades a repository to share-safe format so that future ' + b'shares of this repository share its requirements and configs.' + ) + + +@registerformatvariant class sparserevlog(requirementformatvariant): name = b'sparserevlog' @@ -1439,3 +1460,13 @@ b'repository is verified\n' ) ) + + if sharedsafe.name in addedreqs: + ui.warn( + _( + b'repository upgraded to share safe mode, existing' + b' shares will still work in old non-safe mode. ' + b'Re-share existing shares to use them in safe mode' + b' New shares will be created in safe mode.\n' + ) + )