[Request] [+ ] D10885: debugbackupbundle: use new context manager for silencing the ui

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jun 18 23:58:40 UTC 2021


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10885

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -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:



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210618/682df047/attachment-0001.html>


More information about the Mercurial-patches mailing list