diff mercurial/upgrade.py @ 49343:4f04bb0d8deb

auto-upgrade: add an option to silence the safe-mismatch 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 19:40:35 +0200
parents 2ab79873786e
children 493034cc3265
line wrap: on
line diff
--- a/mercurial/upgrade.py	Tue Jun 14 15:22:05 2022 +0200
+++ b/mercurial/upgrade.py	Tue Jun 14 19:40:35 2022 +0200
@@ -305,6 +305,7 @@
     current_requirements,
     mismatch_config,
     mismatch_warn,
+    mismatch_verbose_upgrade,
 ):
     """Upgrades a share to use share-safe mechanism"""
     wlock = None
@@ -337,7 +338,8 @@
             diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
             current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
         scmutil.writerequires(hgvfs, diffrequires)
-        ui.warn(_(b'repository upgraded to use share-safe mode\n'))
+        if mismatch_verbose_upgrade:
+            ui.warn(_(b'repository upgraded to use share-safe mode\n'))
     except error.LockError as e:
         hint = _(
             b"see `hg help config.format.use-share-safe` for more information"
@@ -366,6 +368,7 @@
     current_requirements,
     mismatch_config,
     mismatch_warn,
+    mismatch_verbose_upgrade,
 ):
     """Downgrades a share which use share-safe to not use it"""
     wlock = None
@@ -394,7 +397,8 @@
             current_requirements |= source_requirements
             current_requirements -= set(requirementsmod.SHARESAFE_REQUIREMENT)
         scmutil.writerequires(hgvfs, current_requirements)
-        ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
+        if mismatch_verbose_upgrade:
+            ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
     except error.LockError as e:
         hint = _(
             b"see `hg help config.format.use-share-safe` for more information"