##// END OF EJS Templates
commands: use context manager for opened bundle file
Gregory Szorc -
r27884:acfe40eb default
parent child Browse files
Show More
@@ -2012,8 +2012,7 b' def debugbuilddag(ui, repo, text=None,'
2012 norepo=True)
2012 norepo=True)
2013 def debugbundle(ui, bundlepath, all=None, **opts):
2013 def debugbundle(ui, bundlepath, all=None, **opts):
2014 """lists the contents of a bundle"""
2014 """lists the contents of a bundle"""
2015 f = hg.openpath(ui, bundlepath)
2015 with hg.openpath(ui, bundlepath) as f:
2016 try:
2017 gen = exchange.readbundle(ui, f, bundlepath)
2016 gen = exchange.readbundle(ui, f, bundlepath)
2018 if isinstance(gen, bundle2.unbundle20):
2017 if isinstance(gen, bundle2.unbundle20):
2019 return _debugbundle2(ui, gen, all=all, **opts)
2018 return _debugbundle2(ui, gen, all=all, **opts)
@@ -2060,8 +2059,6 b' def debugbundle(ui, bundlepath, all=None'
2060 node = chunkdata['node']
2059 node = chunkdata['node']
2061 ui.write("%s\n" % hex(node))
2060 ui.write("%s\n" % hex(node))
2062 chain = node
2061 chain = node
2063 finally:
2064 f.close()
2065
2062
2066 def _debugbundle2(ui, gen, **opts):
2063 def _debugbundle2(ui, gen, **opts):
2067 """lists the contents of a bundle2"""
2064 """lists the contents of a bundle2"""
General Comments 0
You need to be logged in to leave comments. Login now