Mercurial > public > mercurial-scm > hg
diff tests/test-bundle2.t @ 20802:520df53ad26a
bundle2: a very first version of bundle2 unbundler
This changeset introduce an unbundler class to match the bundle2 bundler. It is
currently able to unbundle an empty bundle2 only and will gain more feature at
the same pace than the bundler.
It also comes with its special extension command in test.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 18 Mar 2014 14:28:42 -0700 |
parents | 9c5183cb9bca |
children | 88db3e615319 |
line wrap: on
line diff
--- a/tests/test-bundle2.t Tue Mar 18 14:00:50 2014 -0700 +++ b/tests/test-bundle2.t Tue Mar 18 14:28:42 2014 -0700 @@ -8,6 +8,7 @@ > code. We still need to be able to test it while it grow up. > """ > + > import sys > from mercurial import cmdutil > from mercurial import bundle2 > cmdtable = {} @@ -19,6 +20,14 @@ > bundle = bundle2.bundle20() > for chunk in bundle.getchunks(): > ui.write(chunk) + > + > @command('unbundle2', [], '') + > def cmdunbundle2(ui, repo): + > """read a bundle2 container from standard input""" + > unbundler = bundle2.unbundle20(sys.stdin) + > ui.write('options count: %i\n' % len(unbundler.params)) + > parts = list(unbundler) + > ui.write('parts count: %i\n' % len(parts)) > EOF $ cat >> $HGRCPATH << EOF > [extensions] @@ -34,3 +43,9 @@ $ hg bundle2 HG20\x00\x00\x00\x00 (no-eol) (esc) + +Test parsing of an empty bundle + + $ hg bundle2 | hg unbundle2 + options count: 0 + parts count: 0