From patchwork Sun Sep 8 07:46:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 5] narrow: rely on setting `quiet` mode instead of `pushbuffer` From: Pierre-Yves David X-Patchwork-Id: 41563 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 08 Sep 2019 09:46:01 +0200 # HG changeset patch # User Pierre-Yves David # Date 1567894280 -7200 # Sun Sep 08 00:11:20 2019 +0200 # Node ID b02758303195ae5953d2e1beacda3eec73314b20 # Parent 85d7a41d37ab5ad059320fff6857315db430fdfb # EXP-Topic check-summary # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b02758303195 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. diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -238,16 +238,16 @@ def handlechangegroup_widen(op, inpart): 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()