Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 32694:3ef319e9505f
debugbundle: add --part-type flag to emit only named part types
This removes the need in the tests for grep -A, which is not supported on
Solaris.
author | Danek Duvall <danek.duvall@oracle.com> |
---|---|
date | Mon, 05 Jun 2017 16:19:41 -0700 |
parents | 00a7f7b1af9c |
children | 23734c0e361f |
comparison
equal
deleted
inserted
replaced
32693:c401ad7fdf86 | 32694:3ef319e9505f |
---|---|
312 def _debugbundle2(ui, gen, all=None, **opts): | 312 def _debugbundle2(ui, gen, all=None, **opts): |
313 """lists the contents of a bundle2""" | 313 """lists the contents of a bundle2""" |
314 if not isinstance(gen, bundle2.unbundle20): | 314 if not isinstance(gen, bundle2.unbundle20): |
315 raise error.Abort(_('not a bundle2 file')) | 315 raise error.Abort(_('not a bundle2 file')) |
316 ui.write(('Stream params: %s\n' % repr(gen.params))) | 316 ui.write(('Stream params: %s\n' % repr(gen.params))) |
317 parttypes = opts.get('part_type', []) | |
317 for part in gen.iterparts(): | 318 for part in gen.iterparts(): |
319 if parttypes and part.type not in parttypes: | |
320 continue | |
318 ui.write('%s -- %r\n' % (part.type, repr(part.params))) | 321 ui.write('%s -- %r\n' % (part.type, repr(part.params))) |
319 if part.type == 'changegroup': | 322 if part.type == 'changegroup': |
320 version = part.params.get('version', '01') | 323 version = part.params.get('version', '01') |
321 cg = changegroup.getunbundler(version, part, 'UN') | 324 cg = changegroup.getunbundler(version, part, 'UN') |
322 _debugchangegroup(ui, cg, all=all, indent=4, **opts) | 325 _debugchangegroup(ui, cg, all=all, indent=4, **opts) |
323 if part.type == 'obsmarkers': | 326 if part.type == 'obsmarkers': |
324 _debugobsmarkers(ui, part.read(), all=all, indent=4, **opts) | 327 _debugobsmarkers(ui, part.read(), all=all, indent=4, **opts) |
325 | 328 |
326 @command('debugbundle', | 329 @command('debugbundle', |
327 [('a', 'all', None, _('show all details')), | 330 [('a', 'all', None, _('show all details')), |
331 ('', 'part-type', [], _('show only the named part type')), | |
328 ('', 'spec', None, _('print the bundlespec of the bundle'))], | 332 ('', 'spec', None, _('print the bundlespec of the bundle'))], |
329 _('FILE'), | 333 _('FILE'), |
330 norepo=True) | 334 norepo=True) |
331 def debugbundle(ui, bundlepath, all=None, spec=None, **opts): | 335 def debugbundle(ui, bundlepath, all=None, spec=None, **opts): |
332 """lists the contents of a bundle""" | 336 """lists the contents of a bundle""" |