Show More
@@ -1,59 +1,65 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | mkdir test |
|
3 | mkdir test | |
4 | cd test |
|
4 | cd test | |
5 | hg init |
|
5 | hg init | |
6 | echo foo>foo |
|
6 | echo foo>foo | |
7 | hg commit -Am 1 -d '1 0' |
|
7 | hg commit -Am 1 -d '1 0' | |
8 | echo bar>bar |
|
8 | echo bar>bar | |
9 | hg commit -Am 2 -d '2 0' |
|
9 | hg commit -Am 2 -d '2 0' | |
10 | mkdir baz |
|
10 | mkdir baz | |
11 | echo bletch>baz/bletch |
|
11 | echo bletch>baz/bletch | |
12 | hg commit -Am 3 -d '1000000000 0' |
|
12 | hg commit -Am 3 -d '1000000000 0' | |
13 | echo "[web]" >> .hg/hgrc |
|
13 | echo "[web]" >> .hg/hgrc | |
14 | echo "name = test-archive" >> .hg/hgrc |
|
14 | echo "name = test-archive" >> .hg/hgrc | |
15 | echo "allow_archive = gz bz2, zip" >> .hg/hgrc |
|
15 | echo "allow_archive = gz bz2, zip" >> .hg/hgrc | |
16 | hg serve -p 20059 -d --pid-file=hg.pid |
|
16 | hg serve -p 20059 -d --pid-file=hg.pid | |
17 | cat hg.pid >> $DAEMON_PIDS |
|
17 | cat hg.pid >> $DAEMON_PIDS | |
18 |
|
18 | |||
19 | TIP=`hg id -v | cut -f1 -d' '` |
|
19 | TIP=`hg id -v | cut -f1 -d' '` | |
20 | QTIP=`hg id -q` |
|
20 | QTIP=`hg id -q` | |
21 | cat > getarchive.py <<EOF |
|
21 | cat > getarchive.py <<EOF | |
22 | import sys, urllib2 |
|
22 | import sys, urllib2 | |
23 | node, archive = sys.argv[1:] |
|
23 | node, archive = sys.argv[1:] | |
24 | f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s' |
|
24 | f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s' | |
25 | % (node, archive)) |
|
25 | % (node, archive)) | |
26 | sys.stdout.write(f.read()) |
|
26 | sys.stdout.write(f.read()) | |
27 | EOF |
|
27 | EOF | |
28 | http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/" |
|
28 | http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/" | |
29 | http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - | sed "s/$QTIP/TIP/" |
|
29 | http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - | sed "s/$QTIP/TIP/" | |
30 | http_proxy= python getarchive.py "$TIP" zip > archive.zip |
|
30 | http_proxy= python getarchive.py "$TIP" zip > archive.zip | |
31 | unzip -t archive.zip | sed "s/$QTIP/TIP/" |
|
31 | unzip -t archive.zip | sed "s/$QTIP/TIP/" | |
32 |
|
32 | |||
33 | hg archive -t tar test.tar |
|
33 | hg archive -t tar test.tar | |
34 | tar tf test.tar |
|
34 | tar tf test.tar | |
35 |
|
35 | |||
36 | hg archive -t tbz2 -X baz test.tar.bz2 |
|
36 | hg archive -t tbz2 -X baz test.tar.bz2 | |
37 | bunzip2 -dc test.tar.bz2 | tar tf - |
|
37 | bunzip2 -dc test.tar.bz2 | tar tf - | |
38 |
|
38 | |||
39 | hg archive -t tgz -p %b-%h test-%h.tar.gz |
|
39 | hg archive -t tgz -p %b-%h test-%h.tar.gz | |
40 | gzip -dc test-$QTIP.tar.gz | tar tf - | sed "s/$QTIP/TIP/" |
|
40 | gzip -dc test-$QTIP.tar.gz | tar tf - | sed "s/$QTIP/TIP/" | |
41 |
|
41 | |||
42 |
cat > md5c |
|
42 | cat > md5comp.py <<EOF | |
43 | import md5, sys |
|
43 | import md5, sys | |
44 | print md5.md5(file(sys.argv[1], 'rb').read()).hexdigest() |
|
44 | f1, f2 = sys.argv[1:3] | |
|
45 | h1 = md5.md5(file(f1, 'rb').read()).hexdigest() | |||
|
46 | h2 = md5.md5(file(f2, 'rb').read()).hexdigest() | |||
|
47 | print h1 == h2 or "md5 differ: " + repr((h1, h2)) | |||
45 | EOF |
|
48 | EOF | |
46 |
|
49 | |||
|
50 | # archive name is stored in the archive, so create similar | |||
|
51 | # archives and rename them afterwards. | |||
47 | hg archive -t tgz tip.tar.gz |
|
52 | hg archive -t tgz tip.tar.gz | |
48 | python md5check.py tip.tar.gz |
|
53 | mv tip.tar.gz tip1.tar.gz | |
49 | sleep 1 |
|
54 | sleep 1 | |
50 | hg archive -t tgz tip.tar.gz |
|
55 | hg archive -t tgz tip.tar.gz | |
51 | python md5check.py tip.tar.gz |
|
56 | mv tip.tar.gz tip2.tar.gz | |
|
57 | python md5comp.py tip1.tar.gz tip2.tar.gz | |||
52 |
|
58 | |||
53 | hg archive -t zip -p /illegal test.zip |
|
59 | hg archive -t zip -p /illegal test.zip | |
54 | hg archive -t zip -p very/../bad test.zip |
|
60 | hg archive -t zip -p very/../bad test.zip | |
55 |
|
61 | |||
56 | hg archive -t zip -r 2 test.zip |
|
62 | hg archive -t zip -r 2 test.zip | |
57 | unzip -t test.zip |
|
63 | unzip -t test.zip | |
58 |
|
64 | |||
59 | hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/" |
|
65 | hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/" |
@@ -1,41 +1,40 | |||||
1 | adding foo |
|
1 | adding foo | |
2 | adding bar |
|
2 | adding bar | |
3 | adding baz/bletch |
|
3 | adding baz/bletch | |
4 | test-archive-TIP/.hg_archival.txt |
|
4 | test-archive-TIP/.hg_archival.txt | |
5 | test-archive-TIP/bar |
|
5 | test-archive-TIP/bar | |
6 | test-archive-TIP/baz/bletch |
|
6 | test-archive-TIP/baz/bletch | |
7 | test-archive-TIP/foo |
|
7 | test-archive-TIP/foo | |
8 | test-archive-TIP/.hg_archival.txt |
|
8 | test-archive-TIP/.hg_archival.txt | |
9 | test-archive-TIP/bar |
|
9 | test-archive-TIP/bar | |
10 | test-archive-TIP/baz/bletch |
|
10 | test-archive-TIP/baz/bletch | |
11 | test-archive-TIP/foo |
|
11 | test-archive-TIP/foo | |
12 | Archive: archive.zip |
|
12 | Archive: archive.zip | |
13 | testing: test-archive-TIP/.hg_archival.txt OK |
|
13 | testing: test-archive-TIP/.hg_archival.txt OK | |
14 | testing: test-archive-TIP/bar OK |
|
14 | testing: test-archive-TIP/bar OK | |
15 | testing: test-archive-TIP/baz/bletch OK |
|
15 | testing: test-archive-TIP/baz/bletch OK | |
16 | testing: test-archive-TIP/foo OK |
|
16 | testing: test-archive-TIP/foo OK | |
17 | No errors detected in compressed data of archive.zip. |
|
17 | No errors detected in compressed data of archive.zip. | |
18 | test/.hg_archival.txt |
|
18 | test/.hg_archival.txt | |
19 | test/bar |
|
19 | test/bar | |
20 | test/baz/bletch |
|
20 | test/baz/bletch | |
21 | test/foo |
|
21 | test/foo | |
22 | test/.hg_archival.txt |
|
22 | test/.hg_archival.txt | |
23 | test/bar |
|
23 | test/bar | |
24 | test/foo |
|
24 | test/foo | |
25 | test-TIP/.hg_archival.txt |
|
25 | test-TIP/.hg_archival.txt | |
26 | test-TIP/bar |
|
26 | test-TIP/bar | |
27 | test-TIP/baz/bletch |
|
27 | test-TIP/baz/bletch | |
28 | test-TIP/foo |
|
28 | test-TIP/foo | |
29 | 76ce33f5d5cf8151558e2d9a396c7504 |
|
29 | True | |
30 | 76ce33f5d5cf8151558e2d9a396c7504 |
|
|||
31 | abort: archive prefix contains illegal components |
|
30 | abort: archive prefix contains illegal components | |
32 | Archive: test.zip |
|
31 | Archive: test.zip | |
33 | testing: test/.hg_archival.txt OK |
|
32 | testing: test/.hg_archival.txt OK | |
34 | testing: test/bar OK |
|
33 | testing: test/bar OK | |
35 | testing: test/baz/bletch OK |
|
34 | testing: test/baz/bletch OK | |
36 | testing: test/foo OK |
|
35 | testing: test/foo OK | |
37 | No errors detected in compressed data of test.zip. |
|
36 | No errors detected in compressed data of test.zip. | |
38 | test-TIP/.hg_archival.txt |
|
37 | test-TIP/.hg_archival.txt | |
39 | test-TIP/bar |
|
38 | test-TIP/bar | |
40 | test-TIP/baz/bletch |
|
39 | test-TIP/baz/bletch | |
41 | test-TIP/foo |
|
40 | test-TIP/foo |
General Comments 0
You need to be logged in to leave comments.
Login now