[Updated] D8771: localrepo: only use 'bookmarksinstore' requirement if we have 'store'
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat Aug 1 14:32:38 UTC 2020
pulkit edited the summary of this revision.
pulkit retitled this revision from "localrepo: only use BOOKMARKS_IN_STORE_REQUIRMENT is we have a store" to "localrepo: only use 'bookmarksinstore' requirement if we have 'store'".
pulkit updated this revision to Diff 22169.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8771?vs=22066&id=22169
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8771/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8771
AFFECTED FILES
mercurial/localrepo.py
tests/test-share-bookmarks.t
CHANGE DETAILS
diff --git a/tests/test-share-bookmarks.t b/tests/test-share-bookmarks.t
--- a/tests/test-share-bookmarks.t
+++ b/tests/test-share-bookmarks.t
@@ -279,3 +279,8 @@
bm3 4:62f4ded848e4
bm4 5:92793bfc8cad
$ cd ..
+
+Test that if store is disabled, we drop the bookmarksinstore requirement
+
+ $ hg init brokenrepo --config format.bookmarks-in-store=True --config format.usestore=false
+ ignoring enabled 'format.bookmarks-in-store' config beacuse it is incompatible with disabled 'format.usestore' config
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3315,6 +3315,28 @@
return requirements
+def checkrequirementscompat(ui, requirements):
+ """ Checks compatibility of repository requirements enabled and disabled.
+
+ Returns a set of requirements which needs to be dropped because dependend
+ requirements are not enabled. Also warns users about it """
+
+ dropped = set()
+
+ if b'store' not in requirements:
+ if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
+ ui.warn(
+ _(
+ b'ignoring enabled \'format.bookmarks-in-store\' config '
+ b'beacuse it is incompatible with disabled '
+ b'\'format.usestore\' config\n'
+ )
+ )
+ dropped.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT)
+
+ return dropped
+
+
def filterknowncreateopts(ui, createopts):
"""Filters a dict of repo creation options against options that are known.
@@ -3389,6 +3411,7 @@
)
requirements = newreporequirements(ui, createopts=createopts)
+ requirements -= checkrequirementscompat(ui, requirements)
wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
To: pulkit, #hg-reviewers
Cc: martinvonz, marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200801/846dc09c/attachment.html>
More information about the Mercurial-patches
mailing list