D10109: requirements: also add a fncache constant

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Thu Mar 4 08:33:30 UTC 2021


Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Continue the cleanup to the remaining requirements

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10109

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/repair.py
  mercurial/requirements.py
  mercurial/upgrade_utils/actions.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -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,
@@ -967,7 +967,7 @@
     supported = {
         requirements.DOTENCODE_REQUIREMENT,
         requirements.REVLOGV1_REQUIREMENT,  # allowed in case of downgrade
-        b'fncache',
+        requirements.FNCACHE_REQUIREMENT,
         requirements.GENERALDELTA_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,
         requirements.SIDEDATA_REQUIREMENT,
diff --git a/mercurial/requirements.py b/mercurial/requirements.py
--- a/mercurial/requirements.py
+++ b/mercurial/requirements.py
@@ -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.
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -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 '
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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)
 



To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list