Show More
@@ -45,6 +45,8 b' Binary format is as follow' | |||
|
45 | 45 | The blob contains a space separated list of parameters. parameter with value |
|
46 | 46 | are stored in the form `<name>=<value>`. Both name and value are urlquoted. |
|
47 | 47 | |
|
48 | Empty name are obviously forbidden. | |
|
49 | ||
|
48 | 50 | Stream parameters use a simple textual format for two main reasons: |
|
49 | 51 | |
|
50 | 52 | - Stream level parameters should remains simple and we want to discourage any |
@@ -54,7 +56,6 b' Binary format is as follow' | |||
|
54 | 56 | |
|
55 | 57 | Any Applicative level options MUST go into a bundle2 part instead. |
|
56 | 58 | |
|
57 | ||
|
58 | 59 | Payload part |
|
59 | 60 | ------------------------ |
|
60 | 61 | |
@@ -97,6 +98,8 b' class bundle20(object):' | |||
|
97 | 98 | |
|
98 | 99 | def addparam(self, name, value=None): |
|
99 | 100 | """add a stream level parameter""" |
|
101 | if not name: | |
|
102 | raise ValueError('empty parameter name') | |
|
100 | 103 | self._params.append((name, value)) |
|
101 | 104 | |
|
102 | 105 | def getchunks(self): |
@@ -10,6 +10,7 b' Create an extension to test bundle2 API' | |||
|
10 | 10 | > |
|
11 | 11 | > import sys |
|
12 | 12 | > from mercurial import cmdutil |
|
13 | > from mercurial import util | |
|
13 | 14 | > from mercurial import bundle2 |
|
14 | 15 | > cmdtable = {} |
|
15 | 16 | > command = cmdutil.command(cmdtable) |
@@ -22,7 +23,10 b' Create an extension to test bundle2 API' | |||
|
22 | 23 | > bundler = bundle2.bundle20() |
|
23 | 24 | > for p in opts['param']: |
|
24 | 25 | > p = p.split('=', 1) |
|
25 | > bundler.addparam(*p) | |
|
26 | > try: | |
|
27 | > bundler.addparam(*p) | |
|
28 | > except ValueError, exc: | |
|
29 | > raise util.Abort('%s' % exc) | |
|
26 | 30 | > |
|
27 | 31 | > for chunk in bundler.getchunks(): |
|
28 | 32 | > ui.write(chunk) |
@@ -149,3 +153,12 b' Test unbundling' | |||
|
149 | 153 | babar%#==tutu |
|
150 | 154 | - simple |
|
151 | 155 | parts count: 0 |
|
156 | ||
|
157 | Test buggy input | |
|
158 | --------------------------------------------------- | |
|
159 | ||
|
160 | empty parameter name | |
|
161 | ||
|
162 | $ hg bundle2 --param '' --quiet | |
|
163 | abort: empty parameter name | |
|
164 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now