##// END OF EJS Templates
hgwebdir: test virtual paths leading or trailing separators are stripped
Patrick Mezard -
r5586:b90b7272 default
parent child Browse files
Show More
@@ -1,77 +1,77 b''
1 #!/bin/sh
1 #!/bin/sh
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
3 # collection, different forms of 404s and the subdirectory support.
3 # collection, different forms of 404s and the subdirectory support.
4
4
5 mkdir webdir
5 mkdir webdir
6 cd webdir
6 cd webdir
7
7
8 hg init a
8 hg init a
9 echo a > a/a
9 echo a > a/a
10 hg --cwd a ci -Ama -d'1 0'
10 hg --cwd a ci -Ama -d'1 0'
11
11
12 hg init b
12 hg init b
13 echo b > b/b
13 echo b > b/b
14 hg --cwd b ci -Amb -d'2 0'
14 hg --cwd b ci -Amb -d'2 0'
15
15
16 hg init c
16 hg init c
17 echo c > c/c
17 echo c > c/c
18 hg --cwd c ci -Amc -d'3 0'
18 hg --cwd c ci -Amc -d'3 0'
19 root=`pwd`
19 root=`pwd`
20
20
21 cd ..
21 cd ..
22
22
23 cat > paths.conf <<EOF
23 cat > paths.conf <<EOF
24 [paths]
24 [paths]
25 a=$root/a
25 a=$root/a
26 b=$root/b
26 b=$root/b
27 EOF
27 EOF
28
28
29 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
29 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
30 -A access-paths.log -E error-paths.log
30 -A access-paths.log -E error-paths.log
31 cat hg.pid >> $DAEMON_PIDS
31 cat hg.pid >> $DAEMON_PIDS
32
32
33 echo % should give a 404 - file does not exist
33 echo % should give a 404 - file does not exist
34 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
34 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
35
35
36 echo % should succeed
36 echo % should succeed
37 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
37 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
38 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
38 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
39 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
39 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
40
40
41 echo % should give a 404 - repo is not published
41 echo % should give a 404 - repo is not published
42 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
42 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
43
43
44 cat > paths.conf <<EOF
44 cat > paths.conf <<EOF
45 [paths]
45 [paths]
46 t/a=$root/a
46 t/a/=$root/a
47 b=$root/b
47 b=$root/b
48 EOF
48 EOF
49
49
50 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
50 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
51 -A access-paths.log -E error-paths.log
51 -A access-paths.log -E error-paths.log
52 cat hg.pid >> $DAEMON_PIDS
52 cat hg.pid >> $DAEMON_PIDS
53
53
54 echo % should succeed, slashy names
54 echo % should succeed, slashy names
55 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
55 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
56 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
56 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
57 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
57 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
58 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
58 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
59 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
59 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
60 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
60 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
61 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
61 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
62 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
62 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
63
63
64 cat > collections.conf <<EOF
64 cat > collections.conf <<EOF
65 [collections]
65 [collections]
66 $root=$root
66 $root=$root
67 EOF
67 EOF
68
68
69 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
69 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
70 -A access-collections.log -E error-collections.log
70 -A access-collections.log -E error-collections.log
71 cat hg.pid >> $DAEMON_PIDS
71 cat hg.pid >> $DAEMON_PIDS
72
72
73 echo % should succeed
73 echo % should succeed
74 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
74 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
75 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
75 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
76 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
76 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
77 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
77 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
General Comments 0
You need to be logged in to leave comments. Login now