changeset 46676:ab58098bebed

requirements: also add a store constant Continue the cleanup to the remaining requirements Differential Revision: https://phab.mercurial-scm.org/D10108
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 03 Mar 2021 12:35:29 +0100
parents c3773636ddbb
children b4c2a2af25e2
files mercurial/localrepo.py mercurial/requirements.py mercurial/upgrade_utils/actions.py
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Mar 03 12:33:24 2021 +0100
+++ b/mercurial/localrepo.py	Wed Mar 03 12:35:29 2021 +0100
@@ -942,7 +942,7 @@
 
 def makestore(requirements, path, vfstype):
     """Construct a storage object for a repository."""
-    if b'store' in requirements:
+    if requirementsmod.STORE_REQUIREMENT in requirements:
         if b'fncache' in requirements:
             dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
             return storemod.fncachestore(path, vfstype, dotencode)
@@ -1210,7 +1210,7 @@
         requirementsmod.SHARESAFE_REQUIREMENT,
     }
     _basesupported = supportedformats | {
-        b'store',
+        requirementsmod.STORE_REQUIREMENT,
         b'fncache',
         requirementsmod.SHARED_REQUIREMENT,
         requirementsmod.RELATIVE_SHARED_REQUIREMENT,
@@ -3411,7 +3411,7 @@
 
     requirements = {requirementsmod.REVLOGV1_REQUIREMENT}
     if ui.configbool(b'format', b'usestore'):
-        requirements.add(b'store')
+        requirements.add(requirementsmod.STORE_REQUIREMENT)
         if ui.configbool(b'format', b'usefncache'):
             requirements.add(b'fncache')
             if ui.configbool(b'format', b'dotencode'):
@@ -3493,7 +3493,7 @@
 
     dropped = set()
 
-    if b'store' not in requirements:
+    if requirementsmod.STORE_REQUIREMENT not in requirements:
         if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
             ui.warn(
                 _(
@@ -3632,7 +3632,8 @@
         hgvfs.mkdir(b'cache')
     hgvfs.mkdir(b'wcache')
 
-    if b'store' in requirements and b'sharedrepo' not in createopts:
+    has_store = requirementsmod.STORE_REQUIREMENT in requirements
+    if has_store and b'sharedrepo' not in createopts:
         hgvfs.mkdir(b'store')
 
         # We create an invalid changelog outside the store so very old
--- a/mercurial/requirements.py	Wed Mar 03 12:33:24 2021 +0100
+++ b/mercurial/requirements.py	Wed Mar 03 12:35:29 2021 +0100
@@ -9,6 +9,7 @@
 
 GENERALDELTA_REQUIREMENT = b'generaldelta'
 DOTENCODE_REQUIREMENT = b'dotencode'
+STORE_REQUIREMENT = b'store'
 
 # When narrowing is finalized and no longer subject to format changes,
 # we should move this to just "narrow" or similar.
--- a/mercurial/upgrade_utils/actions.py	Wed Mar 03 12:33:24 2021 +0100
+++ b/mercurial/upgrade_utils/actions.py	Wed Mar 03 12:35:29 2021 +0100
@@ -859,7 +859,7 @@
         # Introduced in Mercurial 0.9.2.
         requirements.REVLOGV1_REQUIREMENT,
         # Introduced in Mercurial 0.9.2.
-        b'store',
+        requirements.STORE_REQUIREMENT,
     }
 
 
@@ -938,7 +938,7 @@
         b'fncache',
         requirements.GENERALDELTA_REQUIREMENT,
         requirements.REVLOGV1_REQUIREMENT,
-        b'store',
+        requirements.STORE_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,
         requirements.SIDEDATA_REQUIREMENT,
         requirements.COPIESSDC_REQUIREMENT,