auto-upgrade: add an option to silence the tracked-hint message
For well tested case, the message can get in the way, so we add a way to disable
it.
--- a/mercurial/configitems.py Tue Jun 14 15:19:45 2022 +0200
+++ b/mercurial/configitems.py Tue Jun 14 15:22:05 2022 +0200
@@ -1313,6 +1313,12 @@
)
coreconfigitem(
b'format',
+ b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet',
+ default=False,
+ experimental=True,
+)
+coreconfigitem(
+ b'format',
b'dotencode',
default=True,
)
--- a/mercurial/helptext/config.txt Tue Jun 14 15:19:45 2022 +0200
+++ b/mercurial/helptext/config.txt Tue Jun 14 15:22:05 2022 +0200
@@ -1024,6 +1024,10 @@
value and `format.use-dirstate-tracked-hint` at the same time.
+``use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet``
+ Hide message when performing such automatic upgrade.
+
+
``use-persistent-nodemap``
Enable or disable the "persistent-nodemap" feature which improves
performance if the Rust extensions are available.
--- a/mercurial/upgrade_utils/auto_upgrade.py Tue Jun 14 15:19:45 2022 +0200
+++ b/mercurial/upgrade_utils/auto_upgrade.py Tue Jun 14 15:22:05 2022 +0200
@@ -101,6 +101,10 @@
b'format',
b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories',
)
+ auto_upgrade_quiet = ui.configbool(
+ b'format',
+ b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet',
+ )
action = None
@@ -115,7 +119,7 @@
hint = b"(see `hg help config.format.use-dirstate-tracked-hint` for details)\n"
def action():
- if not ui.quiet:
+ if not (ui.quiet or auto_upgrade_quiet):
ui.write_err(msg)
ui.write_err(hint)
requirements.add(requirementsmod.DIRSTATE_TRACKED_HINT_V1)
@@ -130,7 +134,7 @@
hint = b"(see `hg help config.format.use-dirstate-tracked-hint` for details)\n"
def action():
- if not ui.quiet:
+ if not (ui.quiet or auto_upgrade_quiet):
ui.write_err(msg)
ui.write_err(hint)
requirements.discard(requirementsmod.DIRSTATE_TRACKED_HINT_V1)
--- a/tests/test-help.t Tue Jun 14 15:19:45 2022 +0200
+++ b/tests/test-help.t Tue Jun 14 15:22:05 2022 +0200
@@ -1611,6 +1611,8 @@
"use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories"
+ "use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet"
+
"use-persistent-nodemap"
"use-share-safe"
--- a/tests/test-upgrade-repo.t Tue Jun 14 15:19:45 2022 +0200
+++ b/tests/test-upgrade-repo.t Tue Jun 14 15:22:05 2022 +0200
@@ -2074,12 +2074,11 @@
> --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.automatic-upgrade-of-mismatching-repositories:quiet=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 upgrading repository to 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)'
dirstate-v2: no
@@ -2091,12 +2090,11 @@
> --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.automatic-upgrade-of-mismatching-repositories:quiet=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 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)'
dirstate-v2: yes
tracked-hint: no