[PATCH] debugbundle: add --part-type flag to emit only named part types
danek.duvall at oracle.com
danek.duvall at oracle.com
Mon Jun 5 23:37:43 UTC 2017
# HG changeset patch
# User Danek Duvall <danek.duvall at oracle.com>
# Date 1496704781 25200
# Mon Jun 05 16:19:41 2017 -0700
# Node ID 67209fdbca98cf2a38b05cb06f093dc376803590
# Parent e696f597d02f971eeed1217096b8f200ddb903d2
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.
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -314,7 +314,10 @@ def _debugbundle2(ui, gen, all=None, **o
if not isinstance(gen, bundle2.unbundle20):
raise error.Abort(_('not a bundle2 file'))
ui.write(('Stream params: %s\n' % repr(gen.params)))
+ part_types = opts.get('part_type', [])
for part in gen.iterparts():
+ if part_types and part.type not in part_types:
+ 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 @@ def _debugbundle2(ui, gen, all=None, **o
@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)
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -247,7 +247,7 @@ Show all commands + options
debugancestor:
debugapplystreamclonebundle:
debugbuilddag: mergeable-file, overwritten-file, new-file
- debugbundle: all, spec
+ debugbundle: all, part-type, spec
debugcheckstate:
debugcolor: style
debugcommands:
diff --git a/tests/test-obsolete-bundle-strip.t b/tests/test-obsolete-bundle-strip.t
--- a/tests/test-obsolete-bundle-strip.t
+++ b/tests/test-obsolete-bundle-strip.t
@@ -67,7 +67,7 @@ obsmarkers. It also check the obsmarkers
> cat "${markersfile}"
> printf "# bundling: "
> hg bundle --hidden --base "parents(roots(${revs}))" --rev "${revs}" "${bundlefile}"
- > hg debugbundle "${bundlefile}" | grep "obsmarkers --" -A 100 | sed 1,2d > "${contentfile}"
+ > hg debugbundle --part-type obsmarkers "${bundlefile}" | sed 1,3d > "${contentfile}"
> echo '### Bundled markers ###'
> cat "${contentfile}"
> echo '### diff <relevant> <bundled> ###'
@@ -86,7 +86,7 @@ obsmarkers. It also check the obsmarkers
> hg debugobsolete --hidden | sort | sed 's/^/ /' > "${prestripfile}"
> hg strip --hidden --rev "${revs}"
> hg debugobsolete --hidden | sort | sed 's/^/ /' > "${poststripfile}"
- > hg debugbundle .hg/strip-backup/* | grep "obsmarkers --" -A 100 | sed 1,2d > "${stripcontentfile}"
+ > hg debugbundle --part-type obsmarkers .hg/strip-backup/* | sed 1,3d > "${stripcontentfile}"
> echo '### Backup markers ###'
> cat "${stripcontentfile}"
> echo '### diff <relevant> <backed-up> ###'
More information about the Mercurial-devel
mailing list