view tests/test-archive @ 2187:09d3eebdd9b2

tests: support older version of bunzip2 and, possibly, gunzip too
author TK Soh <>
date Wed, 03 May 2006 11:25:36 +0200
parents 98cc126f9f3f
line wrap: on
line source


mkdir test
cd test
hg init
echo foo>foo
hg addremove
hg commit -m 1
echo bar>bar
hg addremove
hg commit -m 2
mkdir baz
echo bletch>baz/bletch
hg addremove
hg commit -m 3
echo "[web]" >> .hg/hgrc
echo "name = test-archive" >> .hg/hgrc
echo "allowzip = true" >> .hg/hgrc
echo "allowgz = true" >> .hg/hgrc
echo "allowbz2 = true" >> .hg/hgrc
hg serve -p 20059 -d

TIP=`hg id -v | cut -f1 -d' '`
QTIP=`hg id -q`
cat > <<EOF
import sys, urllib2
node, archive = sys.argv[1:]
f = urllib2.urlopen(';node=%s;type=%s'
                    % (node, archive))
http_proxy= python "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/"
http_proxy= python "$TIP" bz2 | bunzip2 | tar tf - | sed "s/$QTIP/TIP/"
http_proxy= python "$TIP" zip >
unzip -t | sed "s/$QTIP/TIP/"

kill `cat`
sleep 1 # wait for server to scream and die

hg archive -t tar test.tar
tar tf test.tar

hg archive -t tbz2 -X baz test.tar.bz2
bunzip2 -dc test.tar.bz2 | tar tf -

hg archive -t tgz -p %b-%h test-%h.tar.gz
gzip -dc test-$QTIP.tar.gz | tar tf - | sed "s/$QTIP/TIP/"

hg archive -t zip -p /illegal
hg archive -t zip -p very/../bad

hg archive -t zip -r 2
unzip -t