Mercurial > hg
comparison tests/test-bundle2.t @ 20801:9c5183cb9bca
bundle2: very first version of a bundle2 bundler
This changeset is the very first of a long series. It create a new bundle2
module and add a simple class that generate and empty bundle2 container.
The module is documented with the current state of the implementation. For
information about the final goal you may want to consult the mercurial wiki
page:
http://mercurial.selenic.com/wiki/BundleFormat2
The documentation of the module will be updated with later patches adding more and
more feature to the format.
This patches also introduce a test case. This test case build and use its own
small extension that use the new bundle2 module. Since the new format is unable
to do anything right now, we could not use real mercurial code to test it.
Moreover, some advanced feature of the bundle2 spec will not be used by core
mercurial at all. So we need to have them tested.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 18 Mar 2014 14:00:50 -0700 |
parents | |
children | 520df53ad26a |
comparison
equal
deleted
inserted
replaced
20800:8253e55930a3 | 20801:9c5183cb9bca |
---|---|
1 | |
2 Create an extension to test bundle2 API | |
3 | |
4 $ cat > bundle2.py << EOF | |
5 > """A small extension to test bundle2 implementation | |
6 > | |
7 > Current bundle2 implementation is far too limited to be used in any core | |
8 > code. We still need to be able to test it while it grow up. | |
9 > """ | |
10 > | |
11 > from mercurial import cmdutil | |
12 > from mercurial import bundle2 | |
13 > cmdtable = {} | |
14 > command = cmdutil.command(cmdtable) | |
15 > | |
16 > @command('bundle2', [], '') | |
17 > def cmdbundle2(ui, repo): | |
18 > """write a bundle2 container on standard ouput""" | |
19 > bundle = bundle2.bundle20() | |
20 > for chunk in bundle.getchunks(): | |
21 > ui.write(chunk) | |
22 > EOF | |
23 $ cat >> $HGRCPATH << EOF | |
24 > [extensions] | |
25 > bundle2=$TESTTMP/bundle2.py | |
26 > EOF | |
27 | |
28 The extension requires a repo (currently unused) | |
29 | |
30 $ hg init main | |
31 $ cd main | |
32 | |
33 Test simple generation of empty bundle | |
34 | |
35 $ hg bundle2 | |
36 HG20\x00\x00\x00\x00 (no-eol) (esc) |