Mercurial > hg-stable
changeset 49345:b38f5063a0c6
auto-upgrade: add an option to silence the dirstate-v2 message
For well tested case, the message can get in the way, so we add a way to disable
it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 14 Jun 2022 15:19:45 +0200 |
parents | 1b9114709428 |
children | 67b210bb5ce2 |
files | mercurial/configitems.py mercurial/helptext/config.txt mercurial/upgrade_utils/auto_upgrade.py tests/test-help.t tests/test-upgrade-repo.t |
diffstat | 5 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/configitems.py Tue Jun 14 15:17:51 2022 +0200 +++ b/mercurial/configitems.py Tue Jun 14 15:19:45 2022 +0200 @@ -1289,6 +1289,12 @@ ) coreconfigitem( b'format', + b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet', + default=False, + experimental=True, +) +coreconfigitem( + b'format', b'use-dirstate-tracked-hint', default=False, experimental=True,
--- a/mercurial/helptext/config.txt Tue Jun 14 15:17:51 2022 +0200 +++ b/mercurial/helptext/config.txt Tue Jun 14 15:19:45 2022 +0200 @@ -965,6 +965,9 @@ `dirstate-v2` requirement if `format.use-dirstate-v2=no`. So we recommend setting both this value and `format.use-dirstate-v2` at the same time. +``use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet`` + Hide message when performing such automatic upgrade. + ``use-dirstate-tracked-hint`` Enable or disable the writing of "tracked key" file alongside the dirstate. (default to disabled)
--- a/mercurial/upgrade_utils/auto_upgrade.py Tue Jun 14 15:17:51 2022 +0200 +++ b/mercurial/upgrade_utils/auto_upgrade.py Tue Jun 14 15:19:45 2022 +0200 @@ -153,6 +153,10 @@ b'format', b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories', ) + auto_upgrade_dv2_quiet = ui.configbool( + b'format', + b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet', + ) action = None @@ -169,7 +173,7 @@ ) def action(): - if not ui.quiet: + if not (ui.quiet or auto_upgrade_dv2_quiet): ui.write_err(msg) ui.write_err(hint) requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) @@ -186,7 +190,7 @@ ) def action(): - if not ui.quiet: + if not (ui.quiet or auto_upgrade_dv2_quiet): ui.write_err(msg) ui.write_err(hint) requirements.discard(requirementsmod.DIRSTATE_V2_REQUIREMENT)
--- a/tests/test-help.t Tue Jun 14 15:17:51 2022 +0200 +++ b/tests/test-help.t Tue Jun 14 15:19:45 2022 +0200 @@ -1605,6 +1605,8 @@ "use-dirstate-v2.automatic-upgrade-of-mismatching-repositories" + "use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet" + "use-dirstate-tracked-hint" "use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories"
--- a/tests/test-upgrade-repo.t Tue Jun 14 15:17:51 2022 +0200 +++ b/tests/test-upgrade-repo.t Tue Jun 14 15:19:45 2022 +0200 @@ -2071,14 +2071,13 @@ share-safe: yes $ hg status -R auto-upgrade \ > --config format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \ + > --config format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet=yes \ > --config format.use-dirstate-v2=no \ > --config format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes \ > --config format.use-dirstate-tracked-hint=yes \ > --config format.use-share-safe.automatic-upgrade-of-mismatching-repositories=yes \ > --config format.use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet=yes \ > --config format.use-share-safe=no - automatically downgrading repository from the `dirstate-v2` feature - (see `hg help config.format.use-dirstate-v2` for details) automatically upgrading repository to the `tracked-hint` feature (see `hg help config.format.use-dirstate-tracked-hint` for details) @@ -2089,14 +2088,13 @@ $ hg status -R auto-upgrade \ > --config format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \ + > --config format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet=yes \ > --config format.use-dirstate-v2=yes \ > --config format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes \ > --config format.use-dirstate-tracked-hint=no\ > --config format.use-share-safe.automatic-upgrade-of-mismatching-repositories=yes \ > --config format.use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet=yes \ > --config format.use-share-safe=yes - automatically upgrading repository to the `dirstate-v2` feature - (see `hg help config.format.use-dirstate-v2` for details) automatically downgrading repository from the `tracked-hint` feature (see `hg help config.format.use-dirstate-tracked-hint` for details) $ hg debugformat -R auto-upgrade | egrep '(dirstate-v2|tracked|share-safe)'