author | Martin Geisler <mg@lazybytes.net> |
Tue, 17 Aug 2010 16:53:03 +0200 | |
changeset 11916 | d1ea16ca6520 |
parent 11853 | afe19a1bf9d3 |
child 12316 | 4134686b83e1 |
permissions | -rw-r--r-- |
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
1 |
$ mkdir test |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
2 |
$ cd test |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
3 |
$ hg init |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
4 |
$ echo foo>foo |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
5 |
$ hg commit -Am 1 -d '1 0' |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
6 |
adding foo |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
7 |
$ echo bar>bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
8 |
$ hg commit -Am 2 -d '2 0' |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
9 |
adding bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
10 |
$ mkdir baz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
11 |
$ echo bletch>baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
12 |
$ hg commit -Am 3 -d '1000000000 0' |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
13 |
adding baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
14 |
$ echo "[web]" >> .hg/hgrc |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
15 |
$ echo "name = test-archive" >> .hg/hgrc |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
16 |
$ cp .hg/hgrc .hg/hgrc-base |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
17 |
> test_archtype() { |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
18 |
> echo "allow_archive = $1" >> .hg/hgrc |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
19 |
> hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
20 |
> cat hg.pid >> $DAEMON_PIDS |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
21 |
> echo % $1 allowed should give 200 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
22 |
> "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$2" | head -n 1 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
23 |
> echo % $3 and $4 disallowed should both give 403 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
24 |
> "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$3" | head -n 1 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
25 |
> "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$4" | head -n 1 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
26 |
> "$TESTDIR/killdaemons.py" |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
27 |
> cat errors.log |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
28 |
> cp .hg/hgrc-base .hg/hgrc |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
29 |
> } |
1166
bd66294b7a9b
Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
30 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
31 |
check http return codes |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
32 |
|
7029
b84d27386285
hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents:
6496
diff
changeset
|
33 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
34 |
$ test_archtype gz tar.gz tar.bz2 zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
35 |
% gz allowed should give 200 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
36 |
200 Script output follows |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
37 |
% tar.bz2 and zip disallowed should both give 403 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
38 |
403 Archive type not allowed: bz2 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
39 |
403 Archive type not allowed: zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
40 |
$ test_archtype bz2 tar.bz2 zip tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
41 |
% bz2 allowed should give 200 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
42 |
200 Script output follows |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
43 |
% zip and tar.gz disallowed should both give 403 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
44 |
403 Archive type not allowed: zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
45 |
403 Archive type not allowed: gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
46 |
$ test_archtype zip zip tar.gz tar.bz2 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
47 |
% zip allowed should give 200 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
48 |
200 Script output follows |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
49 |
% tar.gz and tar.bz2 disallowed should both give 403 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
50 |
403 Archive type not allowed: gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
51 |
403 Archive type not allowed: bz2 |
7029
b84d27386285
hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents:
6496
diff
changeset
|
52 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
53 |
$ echo "allow_archive = gz bz2 zip" >> .hg/hgrc |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
54 |
$ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
55 |
$ cat hg.pid >> $DAEMON_PIDS |
7029
b84d27386285
hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents:
6496
diff
changeset
|
56 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
57 |
invalid arch type should give 404 |
1166
bd66294b7a9b
Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
58 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
59 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.invalid" | head -n 1 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
60 |
404 Unsupported archive type: None |
7029
b84d27386285
hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents:
6496
diff
changeset
|
61 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
62 |
$ TIP=`hg id -v | cut -f1 -d' '` |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
63 |
$ QTIP=`hg id -q` |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
64 |
$ cat > getarchive.py <<EOF |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
65 |
> import os, sys, urllib2 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
66 |
> try: |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
67 |
> # Set stdout to binary mode for win32 platforms |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
68 |
> import msvcrt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
69 |
> msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
70 |
> except ImportError: |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
71 |
> pass |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
72 |
> node, archive = sys.argv[1:] |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
73 |
> f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s' |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
74 |
> % (os.environ['HGPORT'], node, archive)) |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
75 |
> sys.stdout.write(f.read()) |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
76 |
> EOF |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
77 |
$ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
78 |
test-archive-TIP/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
79 |
test-archive-TIP/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
80 |
test-archive-TIP/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
81 |
test-archive-TIP/foo |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
82 |
$ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
83 |
test-archive-TIP/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
84 |
test-archive-TIP/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
85 |
test-archive-TIP/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
86 |
test-archive-TIP/foo |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
87 |
$ python getarchive.py "$TIP" zip > archive.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
88 |
$ unzip -t archive.zip | sed "s/$QTIP/TIP/" |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
89 |
Archive: archive.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
90 |
testing: test-archive-TIP/.hg_archival.txt OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
91 |
testing: test-archive-TIP/bar OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
92 |
testing: test-archive-TIP/baz/bletch OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
93 |
testing: test-archive-TIP/foo OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
94 |
No errors detected in compressed data of archive.zip. |
1166
bd66294b7a9b
Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
95 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
96 |
$ "$TESTDIR/killdaemons.py" |
7344
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
7080
diff
changeset
|
97 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
98 |
$ hg archive -t tar test.tar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
99 |
$ tar tf test.tar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
100 |
test/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
101 |
test/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
102 |
test/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
103 |
test/foo |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
104 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
105 |
$ hg archive -t tbz2 -X baz test.tar.bz2 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
106 |
$ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
107 |
test/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
108 |
test/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
109 |
test/foo |
2114
98cc126f9f3f
update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1929
diff
changeset
|
110 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
111 |
$ hg archive -t tgz -p %b-%h test-%h.tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
112 |
$ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
113 |
test-TIP/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
114 |
test-TIP/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
115 |
test-TIP/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
116 |
test-TIP/foo |
2114
98cc126f9f3f
update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1929
diff
changeset
|
117 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
118 |
$ hg archive autodetected_test.tar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
119 |
$ tar tf autodetected_test.tar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
120 |
autodetected_test/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
121 |
autodetected_test/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
122 |
autodetected_test/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
123 |
autodetected_test/foo |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10154
diff
changeset
|
124 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
125 |
The '-t' should override autodetection |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
126 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
127 |
$ hg archive -t tar autodetect_override_test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
128 |
$ tar tf autodetect_override_test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
129 |
autodetect_override_test.zip/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
130 |
autodetect_override_test.zip/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
131 |
autodetect_override_test.zip/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
132 |
autodetect_override_test.zip/foo |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10154
diff
changeset
|
133 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
134 |
$ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
135 |
> hg archive auto_test.$ext |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
136 |
> if [ -d auto_test.$ext ]; then |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
137 |
> echo "extension $ext was not autodetected." |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
138 |
> fi |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
139 |
> done |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10154
diff
changeset
|
140 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
141 |
$ cat > md5comp.py <<EOF |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
142 |
> try: |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
143 |
> from hashlib import md5 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
144 |
> except ImportError: |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
145 |
> from md5 import md5 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
146 |
> import sys |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
147 |
> f1, f2 = sys.argv[1:3] |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
148 |
> h1 = md5(file(f1, 'rb').read()).hexdigest() |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
149 |
> h2 = md5(file(f2, 'rb').read()).hexdigest() |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
150 |
> print h1 == h2 or "md5 differ: " + repr((h1, h2)) |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
151 |
> EOF |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
152 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
153 |
archive name is stored in the archive, so create similar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
154 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
155 |
archives and rename them afterwards. |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
156 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
157 |
$ hg archive -t tgz tip.tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
158 |
$ mv tip.tar.gz tip1.tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
159 |
$ sleep 1 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
160 |
$ hg archive -t tgz tip.tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
161 |
$ mv tip.tar.gz tip2.tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
162 |
$ python md5comp.py tip1.tar.gz tip2.tar.gz |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
163 |
True |
4653
ca023b63ba1f
archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents:
2571
diff
changeset
|
164 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
165 |
$ hg archive -t zip -p /illegal test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
166 |
abort: archive prefix contains illegal components |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
167 |
$ hg archive -t zip -p very/../bad test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
168 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
169 |
$ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
170 |
$ unzip -t test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
171 |
Archive: test.zip |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
172 |
testing: test/bar OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
173 |
testing: test/baz/bletch OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
174 |
testing: test/foo OK |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
175 |
No errors detected in compressed data of test.zip. |
4653
ca023b63ba1f
archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents:
2571
diff
changeset
|
176 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
177 |
$ hg archive -t tar - | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
178 |
test-TIP/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
179 |
test-TIP/bar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
180 |
test-TIP/baz/bletch |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
181 |
test-TIP/foo |
2114
98cc126f9f3f
update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1929
diff
changeset
|
182 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
183 |
$ hg archive -r 0 -t tar rev-%r.tar |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
184 |
$ if [ -f rev-0.tar ]; then |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
185 |
$ fi |
2476
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2187
diff
changeset
|
186 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
187 |
test .hg_archival.txt |
4863
6dc0094c0827
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4805
diff
changeset
|
188 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
189 |
$ hg archive ../test-tags |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
190 |
$ cat ../test-tags/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
191 |
repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
192 |
node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
193 |
branch: default |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
194 |
latesttag: null |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
195 |
latesttagdistance: 3 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
196 |
$ hg tag -r 2 mytag |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
197 |
$ hg tag -r 2 anothertag |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
198 |
$ hg archive -r 2 ../test-lasttag |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
199 |
$ cat ../test-lasttag/.hg_archival.txt |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
200 |
repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
201 |
node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
202 |
branch: default |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
203 |
tag: anothertag |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
204 |
tag: mytag |
5061
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4836
diff
changeset
|
205 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
206 |
$ hg archive -t bogus test.bogus |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
207 |
abort: unknown archive type 'bogus' |
9614
58edd448da4f
archive: add branch and tag informations to the .hg_archival.txt file
Gilles Moris <gilles.moris@free.fr>
parents:
8296
diff
changeset
|
208 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
209 |
server errors |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
210 |
|
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
211 |
$ cat errors.log |
6019
b70a530bdb93
cleanly abort on unknown archive type (issue966)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
212 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
213 |
empty repo |
5924
b8009718a211
better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
214 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
215 |
$ hg init ../empty |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
216 |
$ cd ../empty |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
217 |
$ hg archive ../test-empty |
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
218 |
abort: no working directory: please specify a revision |
5924
b8009718a211
better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
219 |
|
11853
afe19a1bf9d3
tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents:
10650
diff
changeset
|
220 |
$ exit 0 |