requirements: also add a fncache constant
authorRaphaël Gomès <rgomes@octobus.net>
Wed, 03 Mar 2021 12:37:13 +0100
changeset 46638 b4c2a2af25e2
parent 46637 ab58098bebed
child 46639 88bd085cf2f8
requirements: also add a fncache constant Continue the cleanup to the remaining requirements Differential Revision: https://phab.mercurial-scm.org/D10109
mercurial/localrepo.py
mercurial/repair.py
mercurial/requirements.py
mercurial/upgrade_utils/actions.py
--- a/mercurial/localrepo.py	Wed Mar 03 12:35:29 2021 +0100
+++ b/mercurial/localrepo.py	Wed Mar 03 12:37:13 2021 +0100
@@ -943,7 +943,7 @@
 def makestore(requirements, path, vfstype):
     """Construct a storage object for a repository."""
     if requirementsmod.STORE_REQUIREMENT in requirements:
-        if b'fncache' in requirements:
+        if requirementsmod.FNCACHE_REQUIREMENT in requirements:
             dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
             return storemod.fncachestore(path, vfstype, dotencode)
 
@@ -1211,7 +1211,7 @@
     }
     _basesupported = supportedformats | {
         requirementsmod.STORE_REQUIREMENT,
-        b'fncache',
+        requirementsmod.FNCACHE_REQUIREMENT,
         requirementsmod.SHARED_REQUIREMENT,
         requirementsmod.RELATIVE_SHARED_REQUIREMENT,
         requirementsmod.DOTENCODE_REQUIREMENT,
@@ -3413,7 +3413,7 @@
     if ui.configbool(b'format', b'usestore'):
         requirements.add(requirementsmod.STORE_REQUIREMENT)
         if ui.configbool(b'format', b'usefncache'):
-            requirements.add(b'fncache')
+            requirements.add(requirementsmod.FNCACHE_REQUIREMENT)
             if ui.configbool(b'format', b'dotencode'):
                 requirements.add(requirementsmod.DOTENCODE_REQUIREMENT)
 
--- a/mercurial/repair.py	Wed Mar 03 12:35:29 2021 +0100
+++ b/mercurial/repair.py	Wed Mar 03 12:37:13 2021 +0100
@@ -443,7 +443,7 @@
     """
     repo = repo.unfiltered()
 
-    if b'fncache' not in repo.requirements:
+    if requirements.FNCACHE_REQUIREMENT not in repo.requirements:
         ui.warn(
             _(
                 b'(not rebuilding fncache because repository does not '
--- a/mercurial/requirements.py	Wed Mar 03 12:35:29 2021 +0100
+++ b/mercurial/requirements.py	Wed Mar 03 12:37:13 2021 +0100
@@ -10,6 +10,7 @@
 GENERALDELTA_REQUIREMENT = b'generaldelta'
 DOTENCODE_REQUIREMENT = b'dotencode'
 STORE_REQUIREMENT = b'store'
+FNCACHE_REQUIREMENT = b'fncache'
 
 # 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:35:29 2021 +0100
+++ b/mercurial/upgrade_utils/actions.py	Wed Mar 03 12:37:13 2021 +0100
@@ -197,7 +197,7 @@
 class fncache(requirementformatvariant):
     name = b'fncache'
 
-    _requirement = b'fncache'
+    _requirement = requirements.FNCACHE_REQUIREMENT
 
     default = True
 
@@ -935,7 +935,7 @@
     """
     supported = {
         requirements.DOTENCODE_REQUIREMENT,
-        b'fncache',
+        requirements.FNCACHE_REQUIREMENT,
         requirements.GENERALDELTA_REQUIREMENT,
         requirements.REVLOGV1_REQUIREMENT,
         requirements.STORE_REQUIREMENT,
@@ -966,7 +966,7 @@
     """
     supported = {
         requirements.DOTENCODE_REQUIREMENT,
-        b'fncache',
+        requirements.FNCACHE_REQUIREMENT,
         requirements.GENERALDELTA_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,
         requirements.SIDEDATA_REQUIREMENT,