--- a/mercurial/localrepo.py Fri Oct 16 18:57:55 2020 +0530
+++ b/mercurial/localrepo.py Mon Nov 23 14:15:26 2020 +0530
@@ -557,6 +557,11 @@
# NOTE: presence of SHARESAFE_REQUIREMENT imply that store requirement
# is present. We never write SHARESAFE_REQUIREMENT for a repo if store
# is not present, refer checkrequirementscompat() for that
+ #
+ # However, if SHARESAFE_REQUIREMENT is not present, it means that the
+ # repository was shared the old way. We check the share source .hg/requires
+ # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
+ # to be reshared
if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
if (
@@ -575,6 +580,15 @@
storevfs = vfsmod.vfs(hgvfs.join(b'store'))
requirements |= _readrequires(storevfs, False)
+ elif shared:
+ sourcerequires = _readrequires(sharedvfs, False)
+ if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
+ ui.warn(
+ _(
+ b'warning: source repository supports share-safe functionality.'
+ b' Reshare to upgrade.\n'
+ )
+ )
# The .hg/hgrc file may load extensions or contain config options
# that influence repository construction. Attempt to load it and