changeset 47438:1be9bf3669cb

debugbackupbundle: use new context manager for silencing the ui A difference between setting `ui.quiet` and using `ui.silent()` is that the latter also silences `ui.write()` calls. That's practically always what one wants, including here, I think. Differential Revision: https://phab.mercurial-scm.org/D10885
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 18 Jun 2021 16:00:58 -0700
parents 7a430116f639
children 86418ad637d1
files mercurial/debugcommands.py
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Fri Jun 18 15:48:51 2021 -0700
+++ b/mercurial/debugcommands.py	Fri Jun 18 16:00:58 2021 -0700
@@ -3791,16 +3791,13 @@
         if revs:
             revs = [other.lookup(rev) for rev in revs]
 
-        quiet = ui.quiet
-        try:
-            ui.quiet = True
-            other, chlist, cleanupfn = bundlerepo.getremotechanges(
-                ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
-            )
-        except error.LookupError:
-            continue
-        finally:
-            ui.quiet = quiet
+        with ui.silent():
+            try:
+                other, chlist, cleanupfn = bundlerepo.getremotechanges(
+                    ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
+                )
+            except error.LookupError:
+                continue
 
         try:
             if not chlist: