Mercurial > hg-stable
diff mercurial/localrepo.py @ 46310:fc2d5c0aed7f
persistent-nodemap: add a "warn" option to the slow-path config
And make it the default until we get an abort option.
Differential Revision: https://phab.mercurial-scm.org/D9761
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 13 Jan 2021 23:07:41 +0100 |
parents | 2c9c88879ab7 |
children | 014ac7a32048 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Jan 13 18:33:48 2021 +0100 +++ b/mercurial/localrepo.py Wed Jan 13 23:07:41 2021 +0100 @@ -59,6 +59,7 @@ rcutil, repoview, requirements as requirementsmod, + revlog, revset, revsetlang, scmutil, @@ -1047,7 +1048,7 @@ slow_path = ui.config( b'storage', b'revlog.persistent-nodemap.slow-path' ) - if slow_path not in (b'allow'): + if slow_path not in (b'allow', b'warn'): default = ui.config_default( b'storage', b'revlog.persistent-nodemap.slow-path' ) @@ -1059,6 +1060,21 @@ if not ui.quiet: ui.warn(_(b'falling back to default value: %s\n') % default) slow_path = default + + msg = _( + b"accessing `persistent-nodemap` repository without associated " + b"fast implementation." + ) + hint = _( + b"check `hg help config.format.use-persistent-nodemap` " + b"for details" + ) + if slow_path == b'warn' and not revlog.HAS_FAST_PERSISTENT_NODEMAP: + msg = b"warning: " + msg + b'\n' + ui.warn(msg) + if not ui.quiet: + hint = b'(' + hint + b')\n' + ui.warn(hint) options[b'persistent-nodemap'] = True if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'): options[b'persistent-nodemap.mmap'] = True