321 for phase in phases.allphases: |
322 for phase in phases.allphases: |
322 for head in headsbyphase[phase]: |
323 for head in headsbyphase[phase]: |
323 ui.write(indent_string) |
324 ui.write(indent_string) |
324 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase])) |
325 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase])) |
325 |
326 |
|
327 def _quasirepr(thing): |
|
328 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)): |
|
329 return '{%s}' % ( |
|
330 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing))) |
|
331 return pycompat.bytestr(repr(thing)) |
|
332 |
326 def _debugbundle2(ui, gen, all=None, **opts): |
333 def _debugbundle2(ui, gen, all=None, **opts): |
327 """lists the contents of a bundle2""" |
334 """lists the contents of a bundle2""" |
328 if not isinstance(gen, bundle2.unbundle20): |
335 if not isinstance(gen, bundle2.unbundle20): |
329 raise error.Abort(_('not a bundle2 file')) |
336 raise error.Abort(_('not a bundle2 file')) |
330 ui.write(('Stream params: %s\n' % repr(gen.params))) |
337 ui.write(('Stream params: %s\n' % _quasirepr(gen.params))) |
331 parttypes = opts.get(r'part_type', []) |
338 parttypes = opts.get(r'part_type', []) |
332 for part in gen.iterparts(): |
339 for part in gen.iterparts(): |
333 if parttypes and part.type not in parttypes: |
340 if parttypes and part.type not in parttypes: |
334 continue |
341 continue |
335 ui.write('%s -- %r\n' % (part.type, repr(part.params))) |
342 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params))) |
336 if part.type == 'changegroup': |
343 if part.type == 'changegroup': |
337 version = part.params.get('version', '01') |
344 version = part.params.get('version', '01') |
338 cg = changegroup.getunbundler(version, part, 'UN') |
345 cg = changegroup.getunbundler(version, part, 'UN') |
339 _debugchangegroup(ui, cg, all=all, indent=4, **opts) |
346 _debugchangegroup(ui, cg, all=all, indent=4, **opts) |
340 if part.type == 'obsmarkers': |
347 if part.type == 'obsmarkers': |