Show More
@@ -1,82 +1,83 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | mkdir test |
|
4 | 4 | cd test |
|
5 | 5 | hg init |
|
6 | 6 | echo foo>foo |
|
7 | 7 | hg commit -Am 1 -d '1 0' |
|
8 | 8 | echo bar>bar |
|
9 | 9 | hg commit -Am 2 -d '2 0' |
|
10 | 10 | mkdir baz |
|
11 | 11 | echo bletch>baz/bletch |
|
12 | 12 | hg commit -Am 3 -d '1000000000 0' |
|
13 | 13 | echo "[web]" >> .hg/hgrc |
|
14 | 14 | echo "name = test-archive" >> .hg/hgrc |
|
15 | 15 | echo "allow_archive = gz bz2, zip" >> .hg/hgrc |
|
16 | 16 | hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log |
|
17 | 17 | cat hg.pid >> $DAEMON_PIDS |
|
18 | 18 | |
|
19 | 19 | TIP=`hg id -v | cut -f1 -d' '` |
|
20 | 20 | QTIP=`hg id -q` |
|
21 | 21 | cat > getarchive.py <<EOF |
|
22 | 22 | import os, sys, urllib2 |
|
23 | 23 | node, archive = sys.argv[1:] |
|
24 | 24 | f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s' |
|
25 | 25 | % (os.environ['HGPORT'], node, archive)) |
|
26 | 26 | sys.stdout.write(f.read()) |
|
27 | 27 | EOF |
|
28 | 28 | http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/" |
|
29 | 29 | http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - | sed "s/$QTIP/TIP/" |
|
30 | 30 | http_proxy= python getarchive.py "$TIP" zip > archive.zip |
|
31 | 31 | unzip -t archive.zip | sed "s/$QTIP/TIP/" |
|
32 | 32 | |
|
33 | 33 | hg archive -t tar test.tar |
|
34 | 34 | tar tf test.tar |
|
35 | 35 | |
|
36 | 36 | hg archive -t tbz2 -X baz test.tar.bz2 |
|
37 | 37 | bunzip2 -dc test.tar.bz2 | tar tf - |
|
38 | 38 | |
|
39 | 39 | hg archive -t tgz -p %b-%h test-%h.tar.gz |
|
40 | 40 | gzip -dc test-$QTIP.tar.gz | tar tf - | sed "s/$QTIP/TIP/" |
|
41 | 41 | |
|
42 | 42 | cat > md5comp.py <<EOF |
|
43 | import md5, sys | |
|
43 | from mercurial.util import md5 | |
|
44 | import sys | |
|
44 | 45 | f1, f2 = sys.argv[1:3] |
|
45 |
h1 = md5 |
|
|
46 |
h2 = md5 |
|
|
46 | h1 = md5(file(f1, 'rb').read()).hexdigest() | |
|
47 | h2 = md5(file(f2, 'rb').read()).hexdigest() | |
|
47 | 48 | print h1 == h2 or "md5 differ: " + repr((h1, h2)) |
|
48 | 49 | EOF |
|
49 | 50 | |
|
50 | 51 | # archive name is stored in the archive, so create similar |
|
51 | 52 | # archives and rename them afterwards. |
|
52 | 53 | hg archive -t tgz tip.tar.gz |
|
53 | 54 | mv tip.tar.gz tip1.tar.gz |
|
54 | 55 | sleep 1 |
|
55 | 56 | hg archive -t tgz tip.tar.gz |
|
56 | 57 | mv tip.tar.gz tip2.tar.gz |
|
57 | 58 | python md5comp.py tip1.tar.gz tip2.tar.gz |
|
58 | 59 | |
|
59 | 60 | hg archive -t zip -p /illegal test.zip |
|
60 | 61 | hg archive -t zip -p very/../bad test.zip |
|
61 | 62 | |
|
62 | 63 | hg archive --config ui.archivemeta=false -t zip -r 2 test.zip |
|
63 | 64 | unzip -t test.zip |
|
64 | 65 | |
|
65 | 66 | hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/" |
|
66 | 67 | |
|
67 | 68 | hg archive -r 0 -t tar rev-%r.tar |
|
68 | 69 | if [ -f rev-0.tar ]; then |
|
69 | 70 | echo 'rev-0.tar created' |
|
70 | 71 | fi |
|
71 | 72 | |
|
72 | 73 | hg archive -t bogus test.bogus |
|
73 | 74 | |
|
74 | 75 | echo % server errors |
|
75 | 76 | cat errors.log |
|
76 | 77 | |
|
77 | 78 | echo '% empty repo' |
|
78 | 79 | hg init ../empty |
|
79 | 80 | cd ../empty |
|
80 | 81 | hg archive ../test-empty |
|
81 | 82 | |
|
82 | 83 | exit 0 |
General Comments 0
You need to be logged in to leave comments.
Login now