mercurial/commands.py
changeset 27884 acfe40eb8cb5
parent 27858 7575c048482d
child 27885 2370c66110cb
equal deleted inserted replaced
27883:4f4b80b3f2bf 27884:acfe40eb8cb5
  2010         [('a', 'all', None, _('show all details'))],
  2010         [('a', 'all', None, _('show all details'))],
  2011         _('FILE'),
  2011         _('FILE'),
  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)
  2020         if all:
  2019         if all:
  2021             ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n"))
  2020             ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n"))
  2058                 if not chunkdata:
  2057                 if not chunkdata:
  2059                     break
  2058                     break
  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"""
  2068     if not isinstance(gen, bundle2.unbundle20):
  2065     if not isinstance(gen, bundle2.unbundle20):
  2069         raise error.Abort(_('not a bundle2 file'))
  2066         raise error.Abort(_('not a bundle2 file'))