From patchwork Thu Mar 4 08:33:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10108: requirements: also add a store constant From: phabricator X-Patchwork-Id: 48422 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 4 Mar 2021 08:33:28 +0000 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/D10108 AFFECTED FILES mercurial/localrepo.py mercurial/requirements.py mercurial/upgrade_utils/actions.py CHANGE DETAILS To: Alphare, #hg-reviewers Cc: mercurial-patches, mercurial-devel 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 @@ -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, diff --git a/mercurial/requirements.py b/mercurial/requirements.py --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -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. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -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