D12030: requirements: move "bookmark in store" requirements in the right module

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jan 24 11:36:45 UTC 2022


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

REVISION SUMMARY
  There seems to be no reasons to not have it with the others.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/bookmarks.py
  mercurial/localrepo.py
  mercurial/requirements.py

CHANGE DETAILS

diff --git a/mercurial/requirements.py b/mercurial/requirements.py
--- a/mercurial/requirements.py
+++ b/mercurial/requirements.py
@@ -66,6 +66,10 @@
 # `.hg/store/requires` are present.
 SHARESAFE_REQUIREMENT = b'share-safe'
 
+# Bookmarks must we stored in the `store` part of the repository and will be
+# share accross shares
+BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore'
+
 # List of requirements which are working directory specific
 # These requirements cannot be shared between repositories if they
 # share the same store
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1288,7 +1288,7 @@
         requirementsmod.CHANGELOGV2_REQUIREMENT,
         requirementsmod.SPARSEREVLOG_REQUIREMENT,
         requirementsmod.NODEMAP_REQUIREMENT,
-        bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT,
+        requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT,
         requirementsmod.SHARESAFE_REQUIREMENT,
         requirementsmod.DIRSTATE_V2_REQUIREMENT,
     }
@@ -3652,7 +3652,7 @@
         requirements.add(b'lfs')
 
     if ui.configbool(b'format', b'bookmarks-in-store'):
-        requirements.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT)
+        requirements.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT)
 
     if ui.configbool(b'format', b'use-persistent-nodemap'):
         requirements.add(requirementsmod.NODEMAP_REQUIREMENT)
@@ -3704,7 +3704,7 @@
     dropped = set()
 
     if requirementsmod.STORE_REQUIREMENT not in requirements:
-        if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
+        if requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
             ui.warn(
                 _(
                     b'ignoring enabled \'format.bookmarks-in-store\' config '
@@ -3712,7 +3712,7 @@
                     b'\'format.usestore\' config\n'
                 )
             )
-            dropped.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT)
+            dropped.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT)
 
         if (
             requirementsmod.SHARED_REQUIREMENT in requirements
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -22,6 +22,7 @@
     error,
     obsutil,
     pycompat,
+    requirements,
     scmutil,
     txnutil,
     util,
@@ -36,11 +37,9 @@
 # custom styles
 activebookmarklabel = b'bookmarks.active bookmarks.current'
 
-BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore'
-
 
 def bookmarksinstore(repo):
-    return BOOKMARKS_IN_STORE_REQUIREMENT in repo.requirements
+    return requirements.BOOKMARKS_IN_STORE_REQUIREMENT in repo.requirements
 
 
 def bookmarksvfs(repo):



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


More information about the Mercurial-devel mailing list