mercurial/debugcommands.py
changeset 33031 e8c8d81eb864
parent 33029 b482d80e041b
child 33057 03eefca3ed33
equal deleted inserted replaced
33030:3e102a8dd52c 33031:e8c8d81eb864
   309             fm.startitem()
   309             fm.startitem()
   310             fm.plain(indent_string)
   310             fm.plain(indent_string)
   311             cmdutil.showmarker(fm, m)
   311             cmdutil.showmarker(fm, m)
   312         fm.end()
   312         fm.end()
   313 
   313 
       
   314 def _debugphaseheads(ui, data, indent=0):
       
   315     """display version and markers contained in 'data'"""
       
   316     indent_string = ' ' * indent
       
   317     headsbyphase = bundle2._readphaseheads(data)
       
   318     for phase in phases.allphases:
       
   319         for head in headsbyphase[phase]:
       
   320             ui.write(indent_string)
       
   321             ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
       
   322 
   314 def _debugbundle2(ui, gen, all=None, **opts):
   323 def _debugbundle2(ui, gen, all=None, **opts):
   315     """lists the contents of a bundle2"""
   324     """lists the contents of a bundle2"""
   316     if not isinstance(gen, bundle2.unbundle20):
   325     if not isinstance(gen, bundle2.unbundle20):
   317         raise error.Abort(_('not a bundle2 file'))
   326         raise error.Abort(_('not a bundle2 file'))
   318     ui.write(('Stream params: %s\n' % repr(gen.params)))
   327     ui.write(('Stream params: %s\n' % repr(gen.params)))
   325             version = part.params.get('version', '01')
   334             version = part.params.get('version', '01')
   326             cg = changegroup.getunbundler(version, part, 'UN')
   335             cg = changegroup.getunbundler(version, part, 'UN')
   327             _debugchangegroup(ui, cg, all=all, indent=4, **opts)
   336             _debugchangegroup(ui, cg, all=all, indent=4, **opts)
   328         if part.type == 'obsmarkers':
   337         if part.type == 'obsmarkers':
   329             _debugobsmarkers(ui, part, indent=4, **opts)
   338             _debugobsmarkers(ui, part, indent=4, **opts)
       
   339         if part.type == 'phase-heads':
       
   340             _debugphaseheads(ui, part, indent=4)
   330 
   341 
   331 @command('debugbundle',
   342 @command('debugbundle',
   332         [('a', 'all', None, _('show all details')),
   343         [('a', 'all', None, _('show all details')),
   333          ('', 'part-type', [], _('show only the named part type')),
   344          ('', 'part-type', [], _('show only the named part type')),
   334          ('', 'spec', None, _('print the bundlespec of the bundle'))],
   345          ('', 'spec', None, _('print the bundlespec of the bundle'))],