Mercurial > public > mercurial-scm > hg
diff mercurial/localrepo.py @ 45300:dc457177dbc1
localrepo: only use 'bookmarksinstore' requirement if we have 'store'
This adds check that whether we have the 'store' requirement or not. If we don't
have that, we skip adding the 'bookmarksinstore' requirement and warn user about
it.
Differential Revision: https://phab.mercurial-scm.org/D8771
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 21 Jul 2020 13:58:58 +0530 |
parents | ce9ee81df9ff |
children | dc283bc7e033 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Jul 25 01:42:41 2020 +0530 +++ b/mercurial/localrepo.py Tue Jul 21 13:58:58 2020 +0530 @@ -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)