diff mercurial/localrepo.py @ 46003:c6a1fa42e325

upgrade: add support to downgrade share safe mode In previous patch we added support to upgrade current repository to use share safe mode. This patch adds support to downgrade to remove share-safe mode. Differential Revision: https://phab.mercurial-scm.org/D9358
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 16 Oct 2020 18:57:55 +0530
parents 89a2afe31e82
children 49b4ab1d9f5e
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jun 25 13:13:21 2020 +0530
+++ b/mercurial/localrepo.py	Fri Oct 16 18:57:55 2020 +0530
@@ -558,6 +558,16 @@
     # is present. We never write SHARESAFE_REQUIREMENT for a repo if store
     # is not present, refer checkrequirementscompat() for that
     if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
+
+        if (
+            shared
+            and requirementsmod.SHARESAFE_REQUIREMENT
+            not in _readrequires(sharedvfs, True)
+        ):
+            raise error.Abort(
+                _(b"share source does not support exp-sharesafe requirement")
+            )
+
         if shared:
             # This is a shared repo
             storevfs = vfsmod.vfs(sharedvfs.join(b'store'))