changeset 46636:c3773636ddbb

requirements: also add a dotencode constant Continue the cleanup to the remaining requirements Differential Revision: https://phab.mercurial-scm.org/D10107
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 03 Mar 2021 12:33:24 +0100
parents e83327af26f1
children ab58098bebed
files mercurial/localrepo.py mercurial/requirements.py mercurial/upgrade_utils/actions.py
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Mar 02 18:51:18 2021 +0100
+++ b/mercurial/localrepo.py	Wed Mar 03 12:33:24 2021 +0100
@@ -944,9 +944,8 @@
     """Construct a storage object for a repository."""
     if b'store' in requirements:
         if b'fncache' in requirements:
-            return storemod.fncachestore(
-                path, vfstype, b'dotencode' in requirements
-            )
+            dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
+            return storemod.fncachestore(path, vfstype, dotencode)
 
         return storemod.encodedstore(path, vfstype)
 
@@ -1215,7 +1214,7 @@
         b'fncache',
         requirementsmod.SHARED_REQUIREMENT,
         requirementsmod.RELATIVE_SHARED_REQUIREMENT,
-        b'dotencode',
+        requirementsmod.DOTENCODE_REQUIREMENT,
         requirementsmod.SPARSE_REQUIREMENT,
         requirementsmod.INTERNAL_PHASE_REQUIREMENT,
     }
@@ -3416,7 +3415,7 @@
         if ui.configbool(b'format', b'usefncache'):
             requirements.add(b'fncache')
             if ui.configbool(b'format', b'dotencode'):
-                requirements.add(b'dotencode')
+                requirements.add(requirementsmod.DOTENCODE_REQUIREMENT)
 
     compengines = ui.configlist(b'format', b'revlog-compression')
     for compengine in compengines:
--- a/mercurial/requirements.py	Tue Mar 02 18:51:18 2021 +0100
+++ b/mercurial/requirements.py	Wed Mar 03 12:33:24 2021 +0100
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 GENERALDELTA_REQUIREMENT = b'generaldelta'
+DOTENCODE_REQUIREMENT = b'dotencode'
 
 # 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	Tue Mar 02 18:51:18 2021 +0100
+++ b/mercurial/upgrade_utils/actions.py	Wed Mar 03 12:33:24 2021 +0100
@@ -217,7 +217,7 @@
 class dotencode(requirementformatvariant):
     name = b'dotencode'
 
-    _requirement = b'dotencode'
+    _requirement = requirements.DOTENCODE_REQUIREMENT
 
     default = True
 
@@ -934,7 +934,7 @@
     Extensions should monkeypatch this to add their custom requirements.
     """
     supported = {
-        b'dotencode',
+        requirements.DOTENCODE_REQUIREMENT,
         b'fncache',
         requirements.GENERALDELTA_REQUIREMENT,
         requirements.REVLOGV1_REQUIREMENT,
@@ -965,7 +965,7 @@
     future, unknown requirements from accidentally being added.
     """
     supported = {
-        b'dotencode',
+        requirements.DOTENCODE_REQUIREMENT,
         b'fncache',
         requirements.GENERALDELTA_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,