Debian Codegraph @

tests/test-flagprocessor.t

raw
1 # Rust index does not support creating new flags dynamically
2
3 #if no-rust
4
5 # Create server
6 $ hg init server
7 $ cd server
8 $ cat >> .hg/hgrc << EOF
9 > [extensions]
10 > extension=$TESTDIR/flagprocessorext.py
11 > EOF
12 $ cd ../
13
14 # Clone server and enable extensions
15 $ hg clone -q server client
16 $ cd client
17 $ cat >> .hg/hgrc << EOF
18 > [extensions]
19 > extension=$TESTDIR/flagprocessorext.py
20 > EOF
21
22 # Commit file that will trigger the noop extension
23 $ echo '[NOOP]' > noop
24 $ hg commit -Aqm "noop"
25
26 # Commit file that will trigger the base64 extension
27 $ echo '[BASE64]' > base64
28 $ hg commit -Aqm 'base64'
29
30 # Commit file that will trigger the gzip extension
31 $ echo '[GZIP]' > gzip
32 $ hg commit -Aqm 'gzip'
33
34 # Commit file that will trigger noop and base64
35 $ echo '[NOOP][BASE64]' > noop-base64
36 $ hg commit -Aqm 'noop+base64'
37
38 # Commit file that will trigger noop and gzip
39 $ echo '[NOOP][GZIP]' > noop-gzip
40 $ hg commit -Aqm 'noop+gzip'
41
42 # Commit file that will trigger base64 and gzip
43 $ echo '[BASE64][GZIP]' > base64-gzip
44 $ hg commit -Aqm 'base64+gzip'
45
46 # Commit file that will trigger base64, gzip and noop
47 $ echo '[BASE64][GZIP][NOOP]' > base64-gzip-noop
48 $ hg commit -Aqm 'base64+gzip+noop'
49
50 # TEST: ensure the revision data is consistent
51 $ hg cat noop
52 [NOOP]
53 $ hg debugdata noop 0
54 [NOOP]
55
56 $ hg cat -r . base64
57 [BASE64]
58 $ hg debugdata base64 0
59 W0JBU0U2NF0K (no-eol)
60
61 $ hg cat -r . gzip
62 [GZIP]
63 $ hg debugdata gzip 0
64 x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
65
66 $ hg cat -r . noop-base64
67 [NOOP][BASE64]
68 $ hg debugdata noop-base64 0
69 W05PT1BdW0JBU0U2NF0K (no-eol)
70
71 $ hg cat -r . noop-gzip
72 [NOOP][GZIP]
73 $ hg debugdata noop-gzip 0
74 x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
75
76 $ hg cat -r . base64-gzip
77 [BASE64][GZIP]
78 $ hg debugdata base64-gzip 0
79 eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
80
81 $ hg cat -r . base64-gzip-noop
82 [BASE64][GZIP][NOOP]
83 $ hg debugdata base64-gzip-noop 0
84 eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
85
86 # Push to the server
87 $ hg push
88 pushing to $TESTTMP/server
89 searching for changes
90 adding changesets
91 adding manifests
92 adding file changes
93 added 7 changesets with 7 changes to 7 files
94
95 Ensure the data got to the server OK
96
97 $ cd ../server
98 $ hg cat -r 6e48f4215d24 noop
99 [NOOP]
100 $ hg debugdata noop 0
101 [NOOP]
102
103 $ hg cat -r 6e48f4215d24 base64
104 [BASE64]
105 $ hg debugdata base64 0
106 W0JBU0U2NF0K (no-eol)
107
108 $ hg cat -r 6e48f4215d24 gzip
109 [GZIP]
110 $ hg debugdata gzip 0
111 x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
112
113 $ hg cat -r 6e48f4215d24 noop-base64
114 [NOOP][BASE64]
115 $ hg debugdata noop-base64 0
116 W05PT1BdW0JBU0U2NF0K (no-eol)
117
118 $ hg cat -r 6e48f4215d24 noop-gzip
119 [NOOP][GZIP]
120 $ hg debugdata noop-gzip 0
121 x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
122
123 $ hg cat -r 6e48f4215d24 base64-gzip
124 [BASE64][GZIP]
125 $ hg debugdata base64-gzip 0
126 eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
127
128 $ hg cat -r 6e48f4215d24 base64-gzip-noop
129 [BASE64][GZIP][NOOP]
130 $ hg debugdata base64-gzip-noop 0
131 eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
132
133 # Initialize new client (not cloning) and setup extension
134 $ cd ..
135 $ hg init client2
136 $ cd client2
137 $ cat >> .hg/hgrc << EOF
138 > [paths]
139 > default = $TESTTMP/server
140 > [extensions]
141 > extension=$TESTDIR/flagprocessorext.py
142 > EOF
143
144 # Pull from server and update to latest revision
145 $ hg pull default
146 pulling from $TESTTMP/server
147 requesting all changes
148 adding changesets
149 adding manifests
150 adding file changes
151 added 7 changesets with 7 changes to 7 files
152 new changesets 07b1b9442c5b:6e48f4215d24
153 (run 'hg update' to get a working copy)
154 $ hg update
155 7 files updated, 0 files merged, 0 files removed, 0 files unresolved
156
157 # TEST: ensure the revision data is consistent
158 $ hg cat noop
159 [NOOP]
160 $ hg debugdata noop 0
161 [NOOP]
162
163 $ hg cat -r . base64
164 [BASE64]
165 $ hg debugdata base64 0
166 W0JBU0U2NF0K (no-eol)
167
168 $ hg cat -r . gzip
169 [GZIP]
170 $ hg debugdata gzip 0
171 x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
172
173 $ hg cat -r . noop-base64
174 [NOOP][BASE64]
175 $ hg debugdata noop-base64 0
176 W05PT1BdW0JBU0U2NF0K (no-eol)
177
178 $ hg cat -r . noop-gzip
179 [NOOP][GZIP]
180 $ hg debugdata noop-gzip 0
181 x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
182
183 $ hg cat -r . base64-gzip
184 [BASE64][GZIP]
185 $ hg debugdata base64-gzip 0
186 eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
187
188 $ hg cat -r . base64-gzip-noop
189 [BASE64][GZIP][NOOP]
190 $ hg debugdata base64-gzip-noop 0
191 eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
192
193 # TEST: ensure a missing processor is handled
194 $ echo '[FAIL][BASE64][GZIP][NOOP]' > fail-base64-gzip-noop
195 $ hg commit -Aqm 'fail+base64+gzip+noop'
196 abort: missing processor for flag '0x1'
197 [50]
198 $ rm fail-base64-gzip-noop
199
200 # TEST: ensure we cannot register several flag processors on the same flag
201 $ cat >> .hg/hgrc << EOF
202 > [extensions]
203 > extension=$TESTDIR/flagprocessorext.py
204 > duplicate=$TESTDIR/flagprocessorext.py
205 > EOF
206 $ hg debugrebuilddirstate 2>&1 | grep -E 'cannot register multiple processors|flagprocessorext'
207 File "$TESTDIR/flagprocessorext.py", line *, in extsetup (glob)
208 mercurial.error.Abort: cannot register multiple processors on flag '0x8'.
209 *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
210 $ hg st 2>&1 | grep -E 'cannot register multiple processors|flagprocessorext'
211 File "$TESTDIR/flagprocessorext.py", line *, in extsetup (glob)
212 mercurial.error.Abort: cannot register multiple processors on flag '0x8'.
213 *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
214 File "$TESTDIR/flagprocessorext.py", line *, in b64decode (glob)
215
216 $ cd ..
217
218 # TEST: bundle repo
219 $ hg init bundletest
220 $ cd bundletest
221
222 $ cat >> .hg/hgrc << EOF
223 > [extensions]
224 > flagprocessor=$TESTDIR/flagprocessorext.py
225 > EOF
226
227 $ for i in 0 single two three 4; do
228 > echo '[BASE64]a-bit-longer-'$i > base64
229 > hg commit -m base64-$i -A base64
230 > done
231
232 $ hg update 2 -q
233 $ echo '[BASE64]a-bit-longer-branching' > base64
234 $ hg commit -q -m branching
235
236 $ hg bundle --base 1 bundle.hg
237 4 changesets found
238 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
239 $ hg -R bundle.hg log --stat -T '{rev} {desc}\n' base64
240 5 branching
241 base64 | 2 +-
242 1 files changed, 1 insertions(+), 1 deletions(-)
243
244 4 base64-4
245 base64 | 2 +-
246 1 files changed, 1 insertions(+), 1 deletions(-)
247
248 3 base64-three
249 base64 | 2 +-
250 1 files changed, 1 insertions(+), 1 deletions(-)
251
252 2 base64-two
253 base64 | 2 +-
254 1 files changed, 1 insertions(+), 1 deletions(-)
255
256 1 base64-single
257 base64 | 2 +-
258 1 files changed, 1 insertions(+), 1 deletions(-)
259
260 0 base64-0
261 base64 | 1 +
262 1 files changed, 1 insertions(+), 0 deletions(-)
263
264
265 $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
266 $ hg -R bundle-again.hg log --stat -T '{rev} {desc}\n' base64
267 5 branching
268 base64 | 2 +-
269 1 files changed, 1 insertions(+), 1 deletions(-)
270
271 4 base64-4
272 base64 | 2 +-
273 1 files changed, 1 insertions(+), 1 deletions(-)
274
275 3 base64-three
276 base64 | 2 +-
277 1 files changed, 1 insertions(+), 1 deletions(-)
278
279 2 base64-two
280 base64 | 2 +-
281 1 files changed, 1 insertions(+), 1 deletions(-)
282
283 1 base64-single
284 base64 | 2 +-
285 1 files changed, 1 insertions(+), 1 deletions(-)
286
287 0 base64-0
288 base64 | 1 +
289 1 files changed, 1 insertions(+), 0 deletions(-)
290
291 $ rm bundle.hg bundle-again.hg
292
293 # TEST: hg status
294
295 $ hg status
296 $ hg diff
297
298
299 #endif