# HG changeset patch # User Pierre-Yves David # Date 1655212296 -7200 # Node ID 9e203cda32382647a89cead00c88b6bf3fdbf555 # Parent 4b239acb23a011983c9c87b3fa93284964ec89a2 auto-upgrade: add an option to silence the share-safe message For well tested case, the message can get in the way, so we add a way to disable it. diff -r 4b239acb23a0 -r 9e203cda3238 mercurial/configitems.py --- a/mercurial/configitems.py Tue Jun 14 15:45:37 2022 +0200 +++ b/mercurial/configitems.py Tue Jun 14 15:11:36 2022 +0200 @@ -1409,6 +1409,12 @@ ) coreconfigitem( b'format', + b'use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet', + default=False, + experimental=True, +) +coreconfigitem( + b'format', b'internal-phase', default=False, experimental=True, diff -r 4b239acb23a0 -r 9e203cda3238 mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt Tue Jun 14 15:45:37 2022 +0200 +++ b/mercurial/helptext/config.txt Tue Jun 14 15:11:36 2022 +0200 @@ -1098,6 +1098,9 @@ `share-safe` requirement if `format.use-share-safe=no`. So we recommend setting both this value and `format.use-share-safe` at the same time. +``use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet`` + Hide message when performing such automatic upgrade. + ``usestore`` Enable or disable the "store" repository format which improves compatibility with systems that fold case or otherwise mangle diff -r 4b239acb23a0 -r 9e203cda3238 mercurial/upgrade_utils/auto_upgrade.py --- a/mercurial/upgrade_utils/auto_upgrade.py Tue Jun 14 15:45:37 2022 +0200 +++ b/mercurial/upgrade_utils/auto_upgrade.py Tue Jun 14 15:11:36 2022 +0200 @@ -44,6 +44,10 @@ b'format', b'use-share-safe.automatic-upgrade-of-mismatching-repositories', ) + auto_upgrade_quiet = ui.configbool( + b'format', + b'use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet', + ) action = None @@ -61,7 +65,7 @@ hint = b"(see `hg help config.format.use-share-safe` 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.SHARESAFE_REQUIREMENT) @@ -75,7 +79,7 @@ hint = b"(see `hg help config.format.use-share-safe` 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.SHARESAFE_REQUIREMENT) diff -r 4b239acb23a0 -r 9e203cda3238 tests/test-help.t --- a/tests/test-help.t Tue Jun 14 15:45:37 2022 +0200 +++ b/tests/test-help.t Tue Jun 14 15:11:36 2022 +0200 @@ -1615,6 +1615,8 @@ "use-share-safe.automatic-upgrade-of-mismatching-repositories" + "use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet" + "usestore" "sparse-revlog" diff -r 4b239acb23a0 -r 9e203cda3238 tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t Tue Jun 14 15:45:37 2022 +0200 +++ b/tests/test-upgrade-repo.t Tue Jun 14 15:11:36 2022 +0200 @@ -2075,11 +2075,10 @@ > --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 downgrading repository from the `share-safe` feature - (see `hg help config.format.use-share-safe` for details) automatically upgrading repository to the `tracked-hint` feature (see `hg help config.format.use-dirstate-tracked-hint` for details) @@ -2094,11 +2093,10 @@ > --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 upgrading repository to the `share-safe` feature - (see `hg help config.format.use-share-safe` 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)'