Mercurial > hg
changeset 27884:acfe40eb8cb5
commands: use context manager for opened bundle file
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 14 Jan 2016 21:27:53 -0800 |
parents | 4f4b80b3f2bf |
children | 2370c66110cb |
files | mercurial/commands.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jan 14 22:49:03 2016 -0800 +++ b/mercurial/commands.py Thu Jan 14 21:27:53 2016 -0800 @@ -2012,8 +2012,7 @@ norepo=True) def debugbundle(ui, bundlepath, all=None, **opts): """lists the contents of a bundle""" - f = hg.openpath(ui, bundlepath) - try: + with hg.openpath(ui, bundlepath) as f: gen = exchange.readbundle(ui, f, bundlepath) if isinstance(gen, bundle2.unbundle20): return _debugbundle2(ui, gen, all=all, **opts) @@ -2060,8 +2059,6 @@ node = chunkdata['node'] ui.write("%s\n" % hex(node)) chain = node - finally: - f.close() def _debugbundle2(ui, gen, **opts): """lists the contents of a bundle2"""