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