##// END OF EJS Templates
tests: update test-archive.t expectations for python3.9 changes...
Augie Fackler -
r45097:862025f1 default
parent child Browse files
Show More
@@ -1,626 +1,630 b''
1 1 #require serve
2 2
3 3 $ hg init test
4 4 $ cd test
5 5 $ echo foo>foo
6 6 $ hg commit -Am 1 -d '1 0'
7 7 adding foo
8 8 $ echo bar>bar
9 9 $ hg commit -Am 2 -d '2 0'
10 10 adding bar
11 11 $ mkdir baz
12 12 $ echo bletch>baz/bletch
13 13 $ hg commit -Am 3 -d '1000000000 0'
14 14 adding baz/bletch
15 15 $ hg init subrepo
16 16 $ touch subrepo/sub
17 17 $ hg -q -R subrepo ci -Am "init subrepo"
18 18 $ echo "subrepo = subrepo" > .hgsub
19 19 $ hg add .hgsub
20 20 $ hg ci -m "add subrepo"
21 21
22 22 $ cat >> $HGRCPATH <<EOF
23 23 > [extensions]
24 24 > share =
25 25 > EOF
26 26
27 27 hg subrepos are shared when the parent repo is shared
28 28
29 29 $ cd ..
30 30 $ hg share test shared1
31 31 updating working directory
32 32 sharing subrepo subrepo from $TESTTMP/test/subrepo
33 33 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 34 $ cat shared1/subrepo/.hg/sharedpath
35 35 $TESTTMP/test/subrepo/.hg (no-eol)
36 36
37 37 hg subrepos are shared into existence on demand if the parent was shared
38 38
39 39 $ hg clone -qr 1 test clone1
40 40 $ hg share clone1 share2
41 41 updating working directory
42 42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 43 $ hg -R clone1 -q pull
44 44 $ hg -R share2 update tip
45 45 sharing subrepo subrepo from $TESTTMP/test/subrepo
46 46 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 47 $ cat share2/subrepo/.hg/sharedpath
48 48 $TESTTMP/test/subrepo/.hg (no-eol)
49 49 $ echo 'mod' > share2/subrepo/sub
50 50 $ hg -R share2 ci -Sqm 'subrepo mod'
51 51 $ hg -R clone1 update -C tip
52 52 cloning subrepo subrepo from $TESTTMP/test/subrepo
53 53 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 54 $ find share2 | egrep 'sharedpath|00.+\.i' | sort
55 55 share2/.hg/sharedpath
56 56 share2/subrepo/.hg/sharedpath
57 57 $ hg -R share2 unshare
58 58 unsharing subrepo 'subrepo'
59 59 $ find share2 | egrep 'sharedpath|00.+\.i' | sort
60 60 share2/.hg/00changelog.i
61 61 share2/.hg/sharedpath.old
62 62 share2/.hg/store/00changelog.i
63 63 share2/.hg/store/00manifest.i
64 64 share2/subrepo/.hg/00changelog.i
65 65 share2/subrepo/.hg/sharedpath.old
66 66 share2/subrepo/.hg/store/00changelog.i
67 67 share2/subrepo/.hg/store/00manifest.i
68 68 $ hg -R share2/subrepo log -r tip -T compact
69 69 1[tip] 559dcc9bfa65 1970-01-01 00:00 +0000 test
70 70 subrepo mod
71 71
72 72 $ rm -rf clone1
73 73
74 74 $ hg clone -qr 1 test clone1
75 75 $ hg share clone1 shared3
76 76 updating working directory
77 77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 78 $ hg -R clone1 -q pull
79 79 $ hg -R shared3 archive --config ui.archivemeta=False -r tip -S archive
80 80 sharing subrepo subrepo from $TESTTMP/test/subrepo
81 81 $ cat shared3/subrepo/.hg/sharedpath
82 82 $TESTTMP/test/subrepo/.hg (no-eol)
83 83 $ diff -r archive test
84 84 Only in test: .hg
85 85 Common subdirectories: archive/baz and test/baz (?)
86 86 Common subdirectories: archive/subrepo and test/subrepo (?)
87 87 Only in test/subrepo: .hg
88 88 [1]
89 89 $ rm -rf archive
90 90
91 91 $ cd test
92 92 $ echo "[web]" >> .hg/hgrc
93 93 $ echo "name = test-archive" >> .hg/hgrc
94 94 $ echo "archivesubrepos = True" >> .hg/hgrc
95 95 $ cp .hg/hgrc .hg/hgrc-base
96 96 > test_archtype() {
97 97 > echo "allow-archive = $1" >> .hg/hgrc
98 98 > test_archtype_run "$@"
99 99 > }
100 100 > test_archtype_deprecated() {
101 101 > echo "allow$1 = True" >> .hg/hgrc
102 102 > test_archtype_run "$@"
103 103 > }
104 104 > test_archtype_run() {
105 105 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log \
106 106 > --config extensions.blackbox= --config blackbox.track=develwarn
107 107 > cat hg.pid >> $DAEMON_PIDS
108 108 > echo % $1 allowed should give 200
109 109 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$2" -
110 110 > f --size --sha1 body
111 111 > echo % $3 and $4 disallowed should both give 403
112 112 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$3" -
113 113 > f --size --sha1 body
114 114 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$4" -
115 115 > f --size --sha1 body
116 116 > killdaemons.py
117 117 > cat errors.log
118 118 > hg blackbox --config extensions.blackbox= --config blackbox.track=
119 119 > cp .hg/hgrc-base .hg/hgrc
120 120 > }
121 121
122 122 check http return codes
123 123
124 124 $ test_archtype gz tar.gz tar.bz2 zip
125 125 % gz allowed should give 200
126 126 200 Script output follows
127 127 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
128 128 content-type: application/x-gzip
129 129 date: $HTTP_DATE$
130 130 etag: W/"*" (glob)
131 131 server: testing stub value
132 132 transfer-encoding: chunked
133 133
134 134 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 (no-py38 !)
135 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 !)
135 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 no-py39 !)
136 body: size=505, sha1=eb823c293bedff0df4070b854e2c5cbb06d6ec62 (py39 !)
136 137 % tar.bz2 and zip disallowed should both give 403
137 138 403 Archive type not allowed: bz2
138 139 content-type: text/html; charset=ascii
139 140 date: $HTTP_DATE$
140 141 etag: W/"*" (glob)
141 142 server: testing stub value
142 143 transfer-encoding: chunked
143 144
144 145 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
145 146 403 Archive type not allowed: zip
146 147 content-type: text/html; charset=ascii
147 148 date: $HTTP_DATE$
148 149 etag: W/"*" (glob)
149 150 server: testing stub value
150 151 transfer-encoding: chunked
151 152
152 153 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
153 154 $ test_archtype bz2 tar.bz2 zip tar.gz
154 155 % bz2 allowed should give 200
155 156 200 Script output follows
156 157 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
157 158 content-type: application/x-bzip2
158 159 date: $HTTP_DATE$
159 160 etag: W/"*" (glob)
160 161 server: testing stub value
161 162 transfer-encoding: chunked
162 163
163 164 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b (no-py38 !)
164 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 !)
165 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 no-py39 !)
166 body: size=503, sha1=2d8ce8bb3816603b9683a1804a5a02c11224cb01 (py39 !)
165 167 % zip and tar.gz disallowed should both give 403
166 168 403 Archive type not allowed: zip
167 169 content-type: text/html; charset=ascii
168 170 date: $HTTP_DATE$
169 171 etag: W/"*" (glob)
170 172 server: testing stub value
171 173 transfer-encoding: chunked
172 174
173 175 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
174 176 403 Archive type not allowed: gz
175 177 content-type: text/html; charset=ascii
176 178 date: $HTTP_DATE$
177 179 etag: W/"*" (glob)
178 180 server: testing stub value
179 181 transfer-encoding: chunked
180 182
181 183 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
182 184 $ test_archtype zip zip tar.gz tar.bz2
183 185 % zip allowed should give 200
184 186 200 Script output follows
185 187 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
186 188 content-type: application/zip
187 189 date: $HTTP_DATE$
188 190 etag: W/"*" (glob)
189 191 server: testing stub value
190 192 transfer-encoding: chunked
191 193
192 194 body: size=(1377|1461|1489), sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537|1897e496871aa89ad685a92b936f5fa0d008b9e8) (re)
193 195 % tar.gz and tar.bz2 disallowed should both give 403
194 196 403 Archive type not allowed: gz
195 197 content-type: text/html; charset=ascii
196 198 date: $HTTP_DATE$
197 199 etag: W/"*" (glob)
198 200 server: testing stub value
199 201 transfer-encoding: chunked
200 202
201 203 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
202 204 403 Archive type not allowed: bz2
203 205 content-type: text/html; charset=ascii
204 206 date: $HTTP_DATE$
205 207 etag: W/"*" (glob)
206 208 server: testing stub value
207 209 transfer-encoding: chunked
208 210
209 211 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
210 212
211 213 check http return codes (with deprecated option)
212 214
213 215 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
214 216 % gz allowed should give 200
215 217 200 Script output follows
216 218 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
217 219 content-type: application/x-gzip
218 220 date: $HTTP_DATE$
219 221 etag: W/"*" (glob)
220 222 server: testing stub value
221 223 transfer-encoding: chunked
222 224
223 225 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 (no-py38 !)
224 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 !)
226 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 no-py39 !)
227 body: size=505, sha1=eb823c293bedff0df4070b854e2c5cbb06d6ec62 (py39 !)
225 228 % tar.bz2 and zip disallowed should both give 403
226 229 403 Archive type not allowed: bz2
227 230 content-type: text/html; charset=ascii
228 231 date: $HTTP_DATE$
229 232 etag: W/"*" (glob)
230 233 server: testing stub value
231 234 transfer-encoding: chunked
232 235
233 236 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
234 237 403 Archive type not allowed: zip
235 238 content-type: text/html; charset=ascii
236 239 date: $HTTP_DATE$
237 240 etag: W/"*" (glob)
238 241 server: testing stub value
239 242 transfer-encoding: chunked
240 243
241 244 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
242 245 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
243 246 % bz2 allowed should give 200
244 247 200 Script output follows
245 248 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
246 249 content-type: application/x-bzip2
247 250 date: $HTTP_DATE$
248 251 etag: W/"*" (glob)
249 252 server: testing stub value
250 253 transfer-encoding: chunked
251 254
252 255 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b (no-py38 !)
253 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 !)
256 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 no-py39 !)
257 body: size=503, sha1=2d8ce8bb3816603b9683a1804a5a02c11224cb01 (py39 !)
254 258 % zip and tar.gz disallowed should both give 403
255 259 403 Archive type not allowed: zip
256 260 content-type: text/html; charset=ascii
257 261 date: $HTTP_DATE$
258 262 etag: W/"*" (glob)
259 263 server: testing stub value
260 264 transfer-encoding: chunked
261 265
262 266 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
263 267 403 Archive type not allowed: gz
264 268 content-type: text/html; charset=ascii
265 269 date: $HTTP_DATE$
266 270 etag: W/"*" (glob)
267 271 server: testing stub value
268 272 transfer-encoding: chunked
269 273
270 274 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
271 275 $ test_archtype_deprecated zip zip tar.gz tar.bz2
272 276 % zip allowed should give 200
273 277 200 Script output follows
274 278 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
275 279 content-type: application/zip
276 280 date: $HTTP_DATE$
277 281 etag: W/"*" (glob)
278 282 server: testing stub value
279 283 transfer-encoding: chunked
280 284
281 285 body: size=(1377|1461|1489), sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537|1897e496871aa89ad685a92b936f5fa0d008b9e8) (re)
282 286 % tar.gz and tar.bz2 disallowed should both give 403
283 287 403 Archive type not allowed: gz
284 288 content-type: text/html; charset=ascii
285 289 date: $HTTP_DATE$
286 290 etag: W/"*" (glob)
287 291 server: testing stub value
288 292 transfer-encoding: chunked
289 293
290 294 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
291 295 403 Archive type not allowed: bz2
292 296 content-type: text/html; charset=ascii
293 297 date: $HTTP_DATE$
294 298 etag: W/"*" (glob)
295 299 server: testing stub value
296 300 transfer-encoding: chunked
297 301
298 302 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
299 303
300 304 $ echo "allow-archive = gz bz2 zip" >> .hg/hgrc
301 305 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
302 306 $ cat hg.pid >> $DAEMON_PIDS
303 307
304 308 check archive links' order
305 309
306 310 $ get-with-headers.py localhost:$HGPORT "?revcount=1" | grep '/archive/tip.'
307 311 <a href="/archive/tip.zip">zip</a>
308 312 <a href="/archive/tip.tar.gz">gz</a>
309 313 <a href="/archive/tip.tar.bz2">bz2</a>
310 314
311 315 invalid arch type should give 404
312 316
313 317 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
314 318 404 Unsupported archive type: None
315 319
316 320 $ TIP=`hg id -v | cut -f1 -d' '`
317 321 $ QTIP=`hg id -q`
318 322 $ cat > getarchive.py <<EOF
319 323 > from __future__ import absolute_import
320 324 > import os
321 325 > import sys
322 326 > from mercurial import (
323 327 > util,
324 328 > )
325 329 > try:
326 330 > # Set stdout to binary mode for win32 platforms
327 331 > import msvcrt
328 332 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
329 333 > except ImportError:
330 334 > pass
331 335 > if len(sys.argv) <= 3:
332 336 > node, archive = sys.argv[1:]
333 337 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
334 338 > else:
335 339 > node, archive, file = sys.argv[1:]
336 340 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
337 341 > try:
338 342 > stdout = sys.stdout.buffer
339 343 > except AttributeError:
340 344 > stdout = sys.stdout
341 345 > try:
342 346 > f = util.urlreq.urlopen('http://$LOCALIP:%s/?%s'
343 347 > % (os.environ['HGPORT'], requeststr))
344 348 > stdout.write(f.read())
345 349 > except util.urlerr.httperror as e:
346 350 > sys.stderr.write(str(e) + '\n')
347 351 > EOF
348 352 $ "$PYTHON" getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
349 353 test-archive-1701ef1f1510/.hg_archival.txt
350 354 test-archive-1701ef1f1510/.hgsub
351 355 test-archive-1701ef1f1510/.hgsubstate
352 356 test-archive-1701ef1f1510/bar
353 357 test-archive-1701ef1f1510/baz/bletch
354 358 test-archive-1701ef1f1510/foo
355 359 test-archive-1701ef1f1510/subrepo/sub
356 360 $ "$PYTHON" getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
357 361 test-archive-1701ef1f1510/.hg_archival.txt
358 362 test-archive-1701ef1f1510/.hgsub
359 363 test-archive-1701ef1f1510/.hgsubstate
360 364 test-archive-1701ef1f1510/bar
361 365 test-archive-1701ef1f1510/baz/bletch
362 366 test-archive-1701ef1f1510/foo
363 367 test-archive-1701ef1f1510/subrepo/sub
364 368 $ "$PYTHON" getarchive.py "$TIP" zip > archive.zip
365 369 $ unzip -t archive.zip
366 370 Archive: archive.zip
367 371 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
368 372 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
369 373 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
370 374 testing: test-archive-1701ef1f1510/bar*OK (glob)
371 375 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
372 376 testing: test-archive-1701ef1f1510/foo*OK (glob)
373 377 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
374 378 No errors detected in compressed data of archive.zip.
375 379
376 380 test that we can download single directories and files
377 381
378 382 $ "$PYTHON" getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
379 383 test-archive-1701ef1f1510/baz/bletch
380 384 $ "$PYTHON" getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
381 385 test-archive-1701ef1f1510/foo
382 386
383 387 test that we detect file patterns that match no files
384 388
385 389 $ "$PYTHON" getarchive.py "$TIP" gz foobar
386 390 HTTP Error 404: file(s) not found: foobar
387 391
388 392 test that we reject unsafe patterns
389 393
390 394 $ "$PYTHON" getarchive.py "$TIP" gz relre:baz
391 395 HTTP Error 404: file(s) not found: relre:baz
392 396
393 397 $ killdaemons.py
394 398
395 399 $ hg archive -t tar test.tar
396 400 $ tar tf test.tar
397 401 test/.hg_archival.txt
398 402 test/.hgsub
399 403 test/.hgsubstate
400 404 test/bar
401 405 test/baz/bletch
402 406 test/foo
403 407
404 408 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
405 409 archiving: 0/4 files (0.00%)
406 410 archiving: .hgsub 1/4 files (25.00%)
407 411 archiving: .hgsubstate 2/4 files (50.00%)
408 412 archiving: bar 3/4 files (75.00%)
409 413 archiving: foo 4/4 files (100.00%)
410 414 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
411 415 test/.hg_archival.txt
412 416 test/.hgsub
413 417 test/.hgsubstate
414 418 test/bar
415 419 test/foo
416 420
417 421 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
418 422 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
419 423 test-1701ef1f1510/.hg_archival.txt
420 424 test-1701ef1f1510/.hgsub
421 425 test-1701ef1f1510/.hgsubstate
422 426 test-1701ef1f1510/bar
423 427 test-1701ef1f1510/baz/bletch
424 428 test-1701ef1f1510/foo
425 429
426 430 $ hg archive autodetected_test.tar
427 431 $ tar tf autodetected_test.tar
428 432 autodetected_test/.hg_archival.txt
429 433 autodetected_test/.hgsub
430 434 autodetected_test/.hgsubstate
431 435 autodetected_test/bar
432 436 autodetected_test/baz/bletch
433 437 autodetected_test/foo
434 438
435 439 The '-t' should override autodetection
436 440
437 441 $ hg archive -t tar autodetect_override_test.zip
438 442 $ tar tf autodetect_override_test.zip
439 443 autodetect_override_test.zip/.hg_archival.txt
440 444 autodetect_override_test.zip/.hgsub
441 445 autodetect_override_test.zip/.hgsubstate
442 446 autodetect_override_test.zip/bar
443 447 autodetect_override_test.zip/baz/bletch
444 448 autodetect_override_test.zip/foo
445 449
446 450 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
447 451 > hg archive auto_test.$ext
448 452 > if [ -d auto_test.$ext ]; then
449 453 > echo "extension $ext was not autodetected."
450 454 > fi
451 455 > done
452 456
453 457 $ cat > md5comp.py <<EOF
454 458 > from __future__ import absolute_import, print_function
455 459 > import hashlib
456 460 > import sys
457 461 > f1, f2 = sys.argv[1:3]
458 462 > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest()
459 463 > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest()
460 464 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
461 465 > EOF
462 466
463 467 archive name is stored in the archive, so create similar archives and
464 468 rename them afterwards.
465 469
466 470 $ hg archive -t tgz tip.tar.gz
467 471 $ mv tip.tar.gz tip1.tar.gz
468 472 $ sleep 1
469 473 $ hg archive -t tgz tip.tar.gz
470 474 $ mv tip.tar.gz tip2.tar.gz
471 475 $ "$PYTHON" md5comp.py tip1.tar.gz tip2.tar.gz
472 476 True
473 477
474 478 $ hg archive -t zip -p /illegal test.zip
475 479 abort: archive prefix contains illegal components
476 480 [255]
477 481 $ hg archive -t zip -p very/../bad test.zip
478 482
479 483 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
480 484 $ unzip -t test.zip
481 485 Archive: test.zip
482 486 testing: test/bar*OK (glob)
483 487 testing: test/baz/bletch*OK (glob)
484 488 testing: test/foo*OK (glob)
485 489 No errors detected in compressed data of test.zip.
486 490
487 491 $ hg archive -t tar - | tar tf - 2>/dev/null
488 492 test-1701ef1f1510/.hg_archival.txt
489 493 test-1701ef1f1510/.hgsub
490 494 test-1701ef1f1510/.hgsubstate
491 495 test-1701ef1f1510/bar
492 496 test-1701ef1f1510/baz/bletch
493 497 test-1701ef1f1510/foo
494 498
495 499 $ hg archive -r 0 -t tar rev-%r.tar
496 500 $ [ -f rev-0.tar ]
497 501
498 502 test .hg_archival.txt
499 503
500 504 $ hg archive ../test-tags
501 505 $ cat ../test-tags/.hg_archival.txt
502 506 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
503 507 node: 1701ef1f151069b8747038e93b5186bb43a47504
504 508 branch: default
505 509 latesttag: null
506 510 latesttagdistance: 4
507 511 changessincelatesttag: 4
508 512 $ hg tag -r 2 mytag
509 513 $ hg tag -r 2 anothertag
510 514 $ hg archive -r 2 ../test-lasttag
511 515 $ cat ../test-lasttag/.hg_archival.txt
512 516 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
513 517 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
514 518 branch: default
515 519 tag: anothertag
516 520 tag: mytag
517 521
518 522 $ hg archive -t bogus test.bogus
519 523 abort: unknown archive type 'bogus'
520 524 [255]
521 525
522 526 enable progress extension:
523 527
524 528 $ cp $HGRCPATH $HGRCPATH.no-progress
525 529 $ cat >> $HGRCPATH <<EOF
526 530 > [progress]
527 531 > assume-tty = 1
528 532 > format = topic bar number
529 533 > delay = 0
530 534 > refresh = 0
531 535 > width = 60
532 536 > EOF
533 537
534 538 $ hg archive ../with-progress
535 539 \r (no-eol) (esc)
536 540 archiving [ ] 0/6\r (no-eol) (esc)
537 541 archiving [======> ] 1/6\r (no-eol) (esc)
538 542 archiving [=============> ] 2/6\r (no-eol) (esc)
539 543 archiving [====================> ] 3/6\r (no-eol) (esc)
540 544 archiving [===========================> ] 4/6\r (no-eol) (esc)
541 545 archiving [==================================> ] 5/6\r (no-eol) (esc)
542 546 archiving [==========================================>] 6/6\r (no-eol) (esc)
543 547 \r (no-eol) (esc)
544 548
545 549 cleanup after progress extension test:
546 550
547 551 $ cp $HGRCPATH.no-progress $HGRCPATH
548 552
549 553 server errors
550 554
551 555 $ cat errors.log
552 556
553 557 empty repo
554 558
555 559 $ hg init ../empty
556 560 $ cd ../empty
557 561 $ hg archive ../test-empty
558 562 abort: no working directory: please specify a revision
559 563 [255]
560 564
561 565 old file -- date clamped to 1980
562 566
563 567 $ touch -t 197501010000 old
564 568 $ hg add old
565 569 $ hg commit -m old
566 570 $ hg archive ../old.zip
567 571 $ unzip -l ../old.zip | grep -v -- ----- | egrep -v files$
568 572 Archive: ../old.zip
569 573 \s*Length.* (re)
570 574 *172*80*00:00*old/.hg_archival.txt (glob)
571 575 *0*80*00:00*old/old (glob)
572 576
573 577 test xz support only available in Python 3.4
574 578
575 579 #if py3
576 580 $ hg archive ../archive.txz
577 581 $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
578 582 Strms Blocks Compressed Uncompressed Ratio Check Filename (xz !)
579 583 $ rm -f ../archive.txz
580 584 #else
581 585 $ hg archive ../archive.txz
582 586 abort: xz compression is only available in Python 3
583 587 [255]
584 588 #endif
585 589
586 590 show an error when a provided pattern matches no files
587 591
588 592 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
589 593 abort: no files match the archive pattern
590 594 [255]
591 595
592 596 $ hg archive -X * ../empty.zip
593 597 abort: no files match the archive pattern
594 598 [255]
595 599
596 600 $ cd ..
597 601
598 602 issue3600: check whether "hg archive" can create archive files which
599 603 are extracted with expected timestamp, even though TZ is not
600 604 configured as GMT.
601 605
602 606 $ mkdir issue3600
603 607 $ cd issue3600
604 608
605 609 $ hg init repo
606 610 $ echo a > repo/a
607 611 $ hg -R repo add repo/a
608 612 $ hg -R repo commit -m '#0' -d '456789012 21600'
609 613 $ cat > show_mtime.py <<EOF
610 614 > from __future__ import absolute_import, print_function
611 615 > import os
612 616 > import sys
613 617 > print(int(os.stat(sys.argv[1]).st_mtime))
614 618 > EOF
615 619
616 620 $ hg -R repo archive --prefix tar-extracted archive.tar
617 621 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
618 622 $ "$PYTHON" show_mtime.py tar-extracted/a
619 623 456789012
620 624
621 625 $ hg -R repo archive --prefix zip-extracted archive.zip
622 626 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
623 627 $ "$PYTHON" show_mtime.py zip-extracted/a
624 628 456789012
625 629
626 630 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now