Mercurial > hg
comparison hgext/narrow/narrowbundle2.py @ 47439:86418ad637d1
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 18 Jun 2021 16:03:42 -0700 |
parents | d55b71393907 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
47438:1be9bf3669cb | 47439:86418ad637d1 |
---|---|
279 ui.note(_(b"adding branch\n")) | 279 ui.note(_(b"adding branch\n")) |
280 f = vfs.open(chgrpfile, b"rb") | 280 f = vfs.open(chgrpfile, b"rb") |
281 try: | 281 try: |
282 gen = exchange.readbundle(ui, f, chgrpfile, vfs) | 282 gen = exchange.readbundle(ui, f, chgrpfile, vfs) |
283 # silence internal shuffling chatter | 283 # silence internal shuffling chatter |
284 override = {(b'ui', b'quiet'): True} | 284 maybe_silent = ( |
285 if ui.verbose: | 285 ui.silent() if not ui.verbose else util.nullcontextmanager() |
286 override = {} | 286 ) |
287 with ui.configoverride(override): | 287 with maybe_silent: |
288 if isinstance(gen, bundle2.unbundle20): | 288 if isinstance(gen, bundle2.unbundle20): |
289 with repo.transaction(b'strip') as tr: | 289 with repo.transaction(b'strip') as tr: |
290 bundle2.processbundle(repo, gen, lambda: tr) | 290 bundle2.processbundle(repo, gen, lambda: tr) |
291 else: | 291 else: |
292 gen.apply( | 292 gen.apply( |