--- a/mercurial/upgrade_utils/actions.py Tue Feb 15 13:32:30 2022 -0500
+++ b/mercurial/upgrade_utils/actions.py Tue Feb 15 23:09:07 2022 +0100
@@ -36,7 +36,10 @@
def preservedrequirements(repo):
- return set()
+ preserved = {
+ requirements.SHARED_REQUIREMENT,
+ }
+ return preserved & repo.requirements
FORMAT_VARIANT = b'deficiency'
@@ -97,6 +100,9 @@
# Whether this improvement touches the dirstate
touches_dirstate = False
+ # Can this action be run on a share instead of its mains repository
+ compatible_with_share = False
+
allformatvariant = [] # type: List[Type['formatvariant']]
@@ -899,8 +905,6 @@
# This was a precursor to generaldelta and was never enabled by default.
# It should (hopefully) not exist in the wild.
b'parentdelta',
- # Upgrade should operate on the actual store, not the shared link.
- requirements.SHARED_REQUIREMENT,
}
@@ -932,6 +936,16 @@
m = _(b'cannot upgrade repository; unsupported source requirement: %s')
blockingreqs = b', '.join(sorted(blockingreqs))
raise error.Abort(m % blockingreqs)
+ # Upgrade should operate on the actual store, not the shared link.
+
+ bad_share = (
+ requirements.SHARED_REQUIREMENT in repo.requirements
+ and requirements.SHARESAFE_REQUIREMENT not in repo.requirements
+ )
+ if bad_share:
+ m = _(b'cannot upgrade repository; share repository without share-safe')
+ h = _(b'check :hg:`help config.format.use-share-safe`')
+ raise error.Abort(m, hint=h)
### Verify the validity of the planned requirement changes ####################
@@ -972,18 +986,19 @@
Extensions should monkeypatch this to add their custom requirements.
"""
supported = {
+ requirements.CHANGELOGV2_REQUIREMENT,
+ requirements.COPIESSDC_REQUIREMENT,
+ requirements.DIRSTATE_V2_REQUIREMENT,
requirements.DOTENCODE_REQUIREMENT,
requirements.FNCACHE_REQUIREMENT,
requirements.GENERALDELTA_REQUIREMENT,
+ requirements.NODEMAP_REQUIREMENT,
requirements.REVLOGV1_REQUIREMENT, # allowed in case of downgrade
- requirements.STORE_REQUIREMENT,
+ requirements.REVLOGV2_REQUIREMENT,
+ requirements.SHARED_REQUIREMENT,
+ requirements.SHARESAFE_REQUIREMENT,
requirements.SPARSEREVLOG_REQUIREMENT,
- requirements.COPIESSDC_REQUIREMENT,
- requirements.NODEMAP_REQUIREMENT,
- requirements.SHARESAFE_REQUIREMENT,
- requirements.REVLOGV2_REQUIREMENT,
- requirements.CHANGELOGV2_REQUIREMENT,
- requirements.DIRSTATE_V2_REQUIREMENT,
+ requirements.STORE_REQUIREMENT,
}
for name in compression.compengines:
engine = compression.compengines[name]