--- a/mercurial/localrepo.py Wed Jan 06 16:18:06 2021 +0530
+++ b/mercurial/localrepo.py Wed Jan 06 18:31:16 2021 +0530
@@ -574,11 +574,26 @@
and requirementsmod.SHARESAFE_REQUIREMENT
not in _readrequires(sharedvfs, True)
):
- raise error.Abort(
- _(b"share source does not support exp-sharesafe requirement")
- )
-
- requirements |= _readrequires(storevfs, False)
+ if ui.configbool(
+ b'experimental', b'sharesafe-auto-downgrade-shares'
+ ):
+ # prevent cyclic import localrepo -> upgrade -> localrepo
+ from . import upgrade
+
+ upgrade.downgrade_share_to_non_safe(
+ ui,
+ hgvfs,
+ sharedvfs,
+ requirements,
+ )
+ else:
+ raise error.Abort(
+ _(
+ b"share source does not support exp-sharesafe requirement"
+ )
+ )
+ else:
+ requirements |= _readrequires(storevfs, False)
elif shared:
sourcerequires = _readrequires(sharedvfs, False)
if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: