narrowbundle: use new context manager for silencing the ui
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 18 Jun 2021 16:03:42 -0700
changeset 47439 86418ad637d1
parent 47438 1be9bf3669cb
child 47440 e43e68624dfb
narrowbundle: use new context manager for silencing the ui Same reasoning as the previous change. This affects a few tests because of the hack from d7304434390f (changegroup: move message about added changes to transaction summary, 2019-09-08). Differential Revision: https://phab.mercurial-scm.org/D10886
hgext/narrow/narrowbundle2.py
tests/test-narrow-patterns.t
tests/test-narrow-widen.t
tests/test-narrow.t
--- a/hgext/narrow/narrowbundle2.py	Fri Jun 18 16:00:58 2021 -0700
+++ b/hgext/narrow/narrowbundle2.py	Fri Jun 18 16:03:42 2021 -0700
@@ -281,10 +281,10 @@
     try:
         gen = exchange.readbundle(ui, f, chgrpfile, vfs)
         # silence internal shuffling chatter
-        override = {(b'ui', b'quiet'): True}
-        if ui.verbose:
-            override = {}
-        with ui.configoverride(override):
+        maybe_silent = (
+            ui.silent() if not ui.verbose else util.nullcontextmanager()
+        )
+        with maybe_silent:
             if isinstance(gen, bundle2.unbundle20):
                 with repo.transaction(b'strip') as tr:
                     bundle2.processbundle(repo, gen, lambda: tr)
--- a/tests/test-narrow-patterns.t	Fri Jun 18 16:00:58 2021 -0700
+++ b/tests/test-narrow-patterns.t	Fri Jun 18 16:03:42 2021 -0700
@@ -139,7 +139,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 9 changesets with 6 changes to 6 files
+  added 9 changesets with 6 changes to 10 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -198,7 +198,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 11 changesets with 7 changes to 7 files
+  added 11 changesets with 7 changes to 12 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -255,7 +255,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 13 changesets with 8 changes to 8 files
+  added 13 changesets with 8 changes to 14 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -312,7 +312,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 13 changesets with 9 changes to 9 files
+  added 13 changesets with 9 changes to 17 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -387,7 +387,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 10 changesets with 6 changes to 6 files
+  added 10 changesets with 6 changes to 8 files
   $ find * | sort
   dir1
   dir1/bar
--- a/tests/test-narrow-widen.t	Fri Jun 18 16:00:58 2021 -0700
+++ b/tests/test-narrow-widen.t	Fri Jun 18 16:03:42 2021 -0700
@@ -118,7 +118,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 3 changesets with 2 changes to 2 files
+  added 3 changesets with 2 changes to 3 files
   $ hg l
   @  ...2: add outside
   |
@@ -190,7 +190,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 8 changesets with 7 changes to 3 files
+  added 8 changesets with 7 changes to 5 files
   $ hg tracked
   I path:inside
   I path:wider
@@ -311,7 +311,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 9 changesets with 5 changes to 5 files
+  added 9 changesets with 5 changes to 9 files
   $ hg tracked
   I path:d0
   I path:d1
--- a/tests/test-narrow.t	Fri Jun 18 16:00:58 2021 -0700
+++ b/tests/test-narrow.t	Fri Jun 18 16:03:42 2021 -0700
@@ -305,7 +305,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 3 changesets with 1 changes to 1 files
+  added 4 changesets with 1 changes to 1 files (+1 heads)
   $ hg tracked
   I path:d0
   $ hg files