# HG changeset patch # User Pierre-Yves David # Date 2022-06-14 13:22:05 # Node ID 67b210bb5ce289749e4ca25dd971b190fd93d931 # Parent b38f5063a0c6e551c0c837a125c09afb463533d0 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. diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1313,6 +1313,12 @@ coreconfigitem( ) 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, ) diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -1024,6 +1024,10 @@ https://www.mercurial-scm.org/wiki/Missi 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. diff --git a/mercurial/upgrade_utils/auto_upgrade.py b/mercurial/upgrade_utils/auto_upgrade.py --- a/mercurial/upgrade_utils/auto_upgrade.py +++ b/mercurial/upgrade_utils/auto_upgrade.py @@ -101,6 +101,10 @@ def get_tracked_hint_action(repo): 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 @@ def get_tracked_hint_action(repo): 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 @@ def get_tracked_hint_action(repo): 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) diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1611,6 +1611,8 @@ Separate sections from subsections "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" diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -2074,12 +2074,11 @@ Quiet upgrade and downgrade > --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 @@ Quiet upgrade and downgrade > --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