tests/test-archive
author mpm@selenic.com
Thu, 15 Sep 2005 14:05:48 -0500
changeset 1260 4603eef60237
parent 1166 bd66294b7a9b
child 1744 385b06493465
child 1923 7d83a351a936
permissions -rwxr-xr-x
hgweb: use ui:username rather than web:contact This also removes the creation of .hg/hgrc with web:contact at init time.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
#!/bin/sh
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     2
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
mkdir test
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     4
cd test
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     5
hg init
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
echo foo>foo
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     7
hg addremove
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     8
hg commit -m 1
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     9
echo bar>bar
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    10
hg addremove
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    11
hg commit -m 2
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    12
mkdir baz
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    13
echo bletch>baz/bletch
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    14
hg addremove
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    15
hg commit -m 3
1260
4603eef60237 hgweb: use ui:username rather than web:contact
mpm@selenic.com
parents: 1166
diff changeset
    16
echo "[web]" >> .hg/hgrc
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    17
echo "name = test-archive" >> .hg/hgrc
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    18
echo "allowzip = true" >> .hg/hgrc
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    19
echo "allowgz = true" >> .hg/hgrc
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    20
echo "allowbz2 = true" >> .hg/hgrc
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    21
hg serve -p 20059 > /dev/null &
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    22
sleep 1 # wait for server to be started
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    23
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    24
TIP=`hg id -v | cut -f1 -d' '`
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    25
QTIP=`hg id -q`
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    26
cat > getarchive.py <<EOF
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    27
import sys, urllib2
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    28
node, archive = sys.argv[1:]
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    29
f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s'
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    30
                    % (node, archive))
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    31
sys.stdout.write(f.read())
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    32
EOF
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    33
http_proxy= python getarchive.py "$TIP" gz | tar tzf - | sed "s/$QTIP/TIP/"
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    34
http_proxy= python getarchive.py "$TIP" bz2 | tar tjf - | sed "s/$QTIP/TIP/"
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    35
http_proxy= python getarchive.py "$TIP" zip > archive.zip
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    36
unzip -t archive.zip | sed "s/$QTIP/TIP/"
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    37
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    38
kill $!