requirements: move "bookmark in store" requirements in the right module
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 17 Jan 2022 19:18:20 +0100
changeset 48599 dfbfa802876b
parent 48598 a6f16ec07ed7
child 48600 d9017df70135
requirements: move "bookmark in store" requirements in the right module There seems to be no reasons to not have it with the others. Differential Revision: https://phab.mercurial-scm.org/D12030
mercurial/bookmarks.py
mercurial/localrepo.py
mercurial/requirements.py
--- a/mercurial/bookmarks.py	Mon Jan 17 18:51:47 2022 +0100
+++ b/mercurial/bookmarks.py	Mon Jan 17 19:18:20 2022 +0100
@@ -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):
--- a/mercurial/localrepo.py	Mon Jan 17 18:51:47 2022 +0100
+++ b/mercurial/localrepo.py	Mon Jan 17 19:18:20 2022 +0100
@@ -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
--- a/mercurial/requirements.py	Mon Jan 17 18:51:47 2022 +0100
+++ b/mercurial/requirements.py	Mon Jan 17 19:18:20 2022 +0100
@@ -66,6 +66,10 @@
 # `.hg/store/requires` are present.
 SHARESAFE_REQUIREMENT = b'share-safe'
 
+# Bookmarks must be 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