view tests/test-archive @ 1534:80a3d6a0af71

Optimize manifest.add Testing shows that manifest.add is spending a significant percentage of its time running calcoffsets and doing text = "".join(addlist). This patch removes the need for both of these by storying the manifest in a character array, and using a modified bisect search to find lines without the help of a separate index of line offsets. manifest.add was also reworked to push delta construction/combination into the main loop. Time to apply 2751 patches (without psyco, ext3 noatime,data=writeback): Stock hg: 4m45s real 3m32s user 55s sys patched: 2m48s real 1m53s user 43s sys quilt: 2m30s real 45s user 50s sys (quilt does much more io...)
author mason@suse.com
date Fri, 11 Nov 2005 18:20:22 -0800
parents 4603eef60237
children 385b06493465 7d83a351a936
line wrap: on
line source

#!/bin/sh

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 > /dev/null &
sleep 1 # wait for server to be started

TIP=`hg id -v | cut -f1 -d' '`
QTIP=`hg id -q`
cat > getarchive.py <<EOF
import sys, urllib2
node, archive = sys.argv[1:]
f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s'
                    % (node, archive))
sys.stdout.write(f.read())
EOF
http_proxy= python getarchive.py "$TIP" gz | tar tzf - | sed "s/$QTIP/TIP/"
http_proxy= python getarchive.py "$TIP" bz2 | tar tjf - | sed "s/$QTIP/TIP/"
http_proxy= python getarchive.py "$TIP" zip > archive.zip
unzip -t archive.zip | sed "s/$QTIP/TIP/"

kill $!