changeset 42901:bbcaf3a74822

narrow: rely on setting `quiet` mode instead of `pushbuffer` The `quiet` approach is what `shelve` uses and give the same result. This will help us to add less code in future changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 08 Sep 2019 00:11:20 +0200
parents 38392d5bde8e
children 7e19b640c53e
files hgext/narrow/narrowbundle2.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowbundle2.py	Sun Oct 14 12:59:02 2018 +0200
+++ b/hgext/narrow/narrowbundle2.py	Sun Sep 08 00:11:20 2019 +0200
@@ -238,16 +238,16 @@
     f = vfs.open(chgrpfile, "rb")
     try:
         gen = exchange.readbundle(ui, f, chgrpfile, vfs)
-        if not ui.verbose:
-            # silence internal shuffling chatter
-            ui.pushbuffer()
-        if isinstance(gen, bundle2.unbundle20):
-            with repo.transaction('strip') as tr:
-                bundle2.processbundle(repo, gen, lambda: tr)
-        else:
-            gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True)
-        if not ui.verbose:
-            ui.popbuffer()
+        # silence internal shuffling chatter
+        override = {('ui', 'quiet'): True}
+        if ui.verbose:
+            override = {}
+        with ui.configoverride(override):
+            if isinstance(gen, bundle2.unbundle20):
+                with repo.transaction('strip') as tr:
+                    bundle2.processbundle(repo, gen, lambda: tr)
+            else:
+                gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True)
     finally:
         f.close()