Show More
@@ -142,9 +142,12 b' class unbundle20(object):' | |||||
142 | @util.propertycache |
|
142 | @util.propertycache | |
143 | def params(self): |
|
143 | def params(self): | |
144 | """dictionnary of stream level parameters""" |
|
144 | """dictionnary of stream level parameters""" | |
145 | paramsize = self._readexact(2) |
|
145 | params = {} | |
146 | assert paramsize == '\0\0' |
|
146 | paramssize = self._unpack(_fstreamparamsize)[0] | |
147 | return {} |
|
147 | if paramssize: | |
|
148 | for p in self._readexact(paramssize).split(' '): | |||
|
149 | params[p] = None | |||
|
150 | return params | |||
148 |
|
151 | |||
149 | def __iter__(self): |
|
152 | def __iter__(self): | |
150 | """yield all parts contained in the stream""" |
|
153 | """yield all parts contained in the stream""" |
@@ -30,6 +30,8 b' Create an extension to test bundle2 API' | |||||
30 | > """read a bundle2 container from standard input""" |
|
30 | > """read a bundle2 container from standard input""" | |
31 | > unbundler = bundle2.unbundle20(sys.stdin) |
|
31 | > unbundler = bundle2.unbundle20(sys.stdin) | |
32 | > ui.write('options count: %i\n' % len(unbundler.params)) |
|
32 | > ui.write('options count: %i\n' % len(unbundler.params)) | |
|
33 | > for key in sorted(unbundler.params): | |||
|
34 | > ui.write('- %s\n' % key) | |||
33 | > parts = list(unbundler) |
|
35 | > parts = list(unbundler) | |
34 | > ui.write('parts count: %i\n' % len(parts)) |
|
36 | > ui.write('parts count: %i\n' % len(parts)) | |
35 | > EOF |
|
37 | > EOF | |
@@ -83,12 +85,28 b' advisory parameters, no value' | |||||
83 |
|
85 | |||
84 | Simplest possible parameters form |
|
86 | Simplest possible parameters form | |
85 |
|
87 | |||
86 | Test generation |
|
88 | Test generation simple option | |
87 |
|
89 | |||
88 | $ hg bundle2 --param 'caution' |
|
90 | $ hg bundle2 --param 'caution' | |
89 | HG20\x00\x07caution\x00\x00 (no-eol) (esc) |
|
91 | HG20\x00\x07caution\x00\x00 (no-eol) (esc) | |
90 |
|
92 | |||
|
93 | Test unbundling | |||
|
94 | ||||
|
95 | $ hg bundle2 --param 'caution' | hg unbundle2 | |||
|
96 | options count: 1 | |||
|
97 | - caution | |||
|
98 | parts count: 0 | |||
|
99 | ||||
91 | Test generation multiple option |
|
100 | Test generation multiple option | |
92 |
|
101 | |||
93 | $ hg bundle2 --param 'caution' --param 'meal' |
|
102 | $ hg bundle2 --param 'caution' --param 'meal' | |
94 | HG20\x00\x0ccaution meal\x00\x00 (no-eol) (esc) |
|
103 | HG20\x00\x0ccaution meal\x00\x00 (no-eol) (esc) | |
|
104 | ||||
|
105 | Test unbundling | |||
|
106 | ||||
|
107 | $ hg bundle2 --param 'caution' --param 'meal' | hg unbundle2 | |||
|
108 | options count: 2 | |||
|
109 | - caution | |||
|
110 | - meal | |||
|
111 | parts count: 0 | |||
|
112 |
General Comments 0
You need to be logged in to leave comments.
Login now