Mercurial > hg
changeset 27885:2370c66110cb
commands: teach debugbundle to print bundle specification
This seems like the most logical place to put this functionality.
Test coverage over existing known bundle specs has been added.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 14 Jan 2016 22:57:55 -0800 |
parents | acfe40eb8cb5 |
children | 0288e63ea3be |
files | mercurial/commands.py tests/test-bundle-type.t tests/test-bundle.t tests/test-completion.t |
diffstat | 4 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jan 14 21:27:53 2016 -0800 +++ b/mercurial/commands.py Thu Jan 14 22:57:55 2016 -0800 @@ -2007,12 +2007,18 @@ release(tr, lock) @command('debugbundle', - [('a', 'all', None, _('show all details'))], + [('a', 'all', None, _('show all details')), + ('', 'spec', None, _('print the bundlespec of the bundle'))], _('FILE'), norepo=True) -def debugbundle(ui, bundlepath, all=None, **opts): +def debugbundle(ui, bundlepath, all=None, spec=None, **opts): """lists the contents of a bundle""" with hg.openpath(ui, bundlepath) as f: + if spec: + spec = exchange.getbundlespec(ui, f) + ui.write('%s\n' % spec) + return + gen = exchange.readbundle(ui, f, bundlepath) if isinstance(gen, bundle2.unbundle20): return _debugbundle2(ui, gen, all=all, **opts)
--- a/tests/test-bundle-type.t Thu Jan 14 21:27:53 2016 -0800 +++ b/tests/test-bundle-type.t Thu Jan 14 22:57:55 2016 -0800 @@ -43,6 +43,7 @@ > f -q -B6 -D ../b$t; echo > cd ../t$t > hg debugbundle ../b$t + > hg debugbundle --spec ../b$t > echo > cd .. > done @@ -53,6 +54,7 @@ Stream params: {} changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + none-v2 % test bundle type bzip2 searching for changes @@ -61,6 +63,7 @@ Stream params: {'Compression': 'BZ'} changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + bzip2-v2 % test bundle type gzip searching for changes @@ -69,6 +72,7 @@ Stream params: {'Compression': 'GZ'} changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + gzip-v2 % test bundle type none-v2 searching for changes @@ -77,6 +81,7 @@ Stream params: {} changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + none-v2 % test bundle type v2 searching for changes @@ -85,18 +90,21 @@ Stream params: {'Compression': 'BZ'} changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + bzip2-v2 % test bundle type v1 searching for changes 1 changesets found HG10BZ c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + bzip2-v1 % test bundle type gzip-v1 searching for changes 1 changesets found HG10GZ c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf + gzip-v1 test garbage file
--- a/tests/test-bundle.t Thu Jan 14 21:27:53 2016 -0800 +++ b/tests/test-bundle.t Thu Jan 14 22:57:55 2016 -0800 @@ -276,6 +276,9 @@ 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 00 64 61 |elta,revlogv1.da| 0030: 74 61 2f 61 64 69 66 66 65 72 65 6e 74 66 69 6c |ta/adifferentfil| + $ hg debugbundle --spec packed.hg + none-packed1;requirements%3Dgeneraldelta%2Crevlogv1 + generaldelta requirement is listed in stream clone bundles $ hg --config format.generaldelta=true init testgd @@ -294,6 +297,9 @@ 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 00 64 61 |elta,revlogv1.da| 0030: 74 61 2f 66 6f 6f 2e 69 00 36 34 0a 00 03 00 01 |ta/foo.i.64.....| + $ hg debugbundle --spec packedgd.hg + none-packed1;requirements%3Dgeneraldelta%2Crevlogv1 + Unpacking packed1 bundles with "hg unbundle" isn't allowed $ hg init packed
--- a/tests/test-completion.t Thu Jan 14 21:27:53 2016 -0800 +++ b/tests/test-completion.t Thu Jan 14 22:57:55 2016 -0800 @@ -236,7 +236,7 @@ debugancestor: debugapplystreamclonebundle: debugbuilddag: mergeable-file, overwritten-file, new-file - debugbundle: all + debugbundle: all, spec debugcheckstate: debugcommands: debugcomplete: options