tests/test-hgwebdirsym
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
Wed, 18 Nov 2009 12:47:58 +0100
changeset 9881 54b518fc6671
parent 6341 63bdfcc3eaaf
permissions -rwxr-xr-x
httprepo: suppress the `real URL is...' message in safe, common cases. When the actual and requested URL only differ by trailing slashes, there is no need to warn. As an example, this easily happens when accessing repositories on Bitbucket over HTTP(S). As far as I could tell, there were no existing tests for this behaviour.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     1
#!/bin/sh
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     2
# Tests whether or not hgwebdir properly handles various symlink topologies.
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     3
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     4
"$TESTDIR/hghave" symlink || exit 80
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     5
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     6
hg init a
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     7
echo a > a/a
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     8
hg --cwd a ci -Ama -d'1 0'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     9
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    10
mkdir webdir
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    11
cd webdir
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    12
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    13
hg init b
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    14
echo b > b/b
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    15
hg --cwd b ci -Amb -d'2 0'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    16
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    17
hg init c
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    18
echo c > c/c
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    19
hg --cwd c ci -Amc -d'3 0'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    20
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    21
ln -s ../a al
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    22
ln -s ../webdir circle
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    23
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    24
root=`pwd`
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    25
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    26
cd ..
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    27
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    28
cat > collections.conf <<EOF
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    29
[collections]
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    30
$root=$root
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    31
EOF
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    32
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    33
hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf collections.conf \
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    34
    -A access-collections.log -E error-collections.log
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    35
cat hg.pid >> $DAEMON_PIDS
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    36
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    37
echo % should succeed
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    38
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    39
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/al/file/tip/a?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    40
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    41
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    42
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    43
echo % should fail
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    44
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/al/file/tip/a?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    45
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/b/file/tip/a?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    46
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/c/file/tip/a?style=raw'
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    47
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    48
echo % collections errors
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    49
cat error-collections.log