diff mercurial/debugcommands.py @ 32714: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
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Mon Jun 05 20:37:45 2017 -0400
+++ b/mercurial/debugcommands.py	Mon Jun 05 16:19:41 2017 -0700
@@ -314,7 +314,10 @@
     if not isinstance(gen, bundle2.unbundle20):
         raise error.Abort(_('not a bundle2 file'))
     ui.write(('Stream params: %s\n' % repr(gen.params)))
+    parttypes = opts.get('part_type', [])
     for part in gen.iterparts():
+        if parttypes and part.type not in parttypes:
+            continue
         ui.write('%s -- %r\n' % (part.type, repr(part.params)))
         if part.type == 'changegroup':
             version = part.params.get('version', '01')
@@ -325,6 +328,7 @@
 
 @command('debugbundle',
         [('a', 'all', None, _('show all details')),
+         ('', 'part-type', [], _('show only the named part type')),
          ('', 'spec', None, _('print the bundlespec of the bundle'))],
         _('FILE'),
         norepo=True)