Show More
@@ -1,161 +1,161 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 | # create a mercurial queue repository |
|
11 | # create a mercurial queue repository | |
12 | hg --cwd a qinit --config extensions.hgext.mq= -c |
|
12 | hg --cwd a qinit --config extensions.hgext.mq= -c | |
13 |
|
13 | |||
14 | hg init b |
|
14 | hg init b | |
15 | echo b > b/b |
|
15 | echo b > b/b | |
16 | hg --cwd b ci -Amb -d'2 0' |
|
16 | hg --cwd b ci -Amb -d'2 0' | |
17 |
|
17 | |||
18 | # create a nested repository |
|
18 | # create a nested repository | |
19 | cd b |
|
19 | cd b | |
20 | hg init d |
|
20 | hg init d | |
21 | echo d > d/d |
|
21 | echo d > d/d | |
22 | hg --cwd d ci -Amd -d'3 0' |
|
22 | hg --cwd d ci -Amd -d'3 0' | |
23 | cd .. |
|
23 | cd .. | |
24 |
|
24 | |||
25 | hg init c |
|
25 | hg init c | |
26 | echo c > c/c |
|
26 | echo c > c/c | |
27 | hg --cwd c ci -Amc -d'3 0' |
|
27 | hg --cwd c ci -Amc -d'3 0' | |
28 |
|
28 | |||
29 | root=`pwd` |
|
29 | root=`pwd` | |
30 | cd .. |
|
30 | cd .. | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | cat > paths.conf <<EOF |
|
33 | cat > paths.conf <<EOF | |
34 | [paths] |
|
34 | [paths] | |
35 | a=$root/a |
|
35 | a=$root/a | |
36 | b=$root/b |
|
36 | b=$root/b | |
37 | EOF |
|
37 | EOF | |
38 |
|
38 | |||
39 | hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \ |
|
39 | hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \ | |
40 | -A access-paths.log -E error-paths-1.log |
|
40 | -A access-paths.log -E error-paths-1.log | |
41 | cat hg.pid >> $DAEMON_PIDS |
|
41 | cat hg.pid >> $DAEMON_PIDS | |
42 |
|
42 | |||
43 | echo % should give a 404 - file does not exist |
|
43 | echo % should give a 404 - file does not exist | |
44 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw' |
|
44 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw' | |
45 |
|
45 | |||
46 | echo % should succeed |
|
46 | echo % should succeed | |
47 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw' |
|
47 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw' | |
48 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw' |
|
48 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw' | |
49 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw' |
|
49 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw' | |
50 |
|
50 | |||
51 | echo % should give a 404 - repo is not published |
|
51 | echo % should give a 404 - repo is not published | |
52 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw' |
|
52 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw' | |
53 |
|
53 | |||
54 | echo % atom-log without basedir |
|
54 | echo % atom-log without basedir | |
55 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' \ |
|
55 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' \ | |
56 |
| grep '<link' | sed 's|//[.a-zA-Z0-9 |
|
56 | | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
57 |
|
57 | |||
58 | echo % rss-log without basedir |
|
58 | echo % rss-log without basedir | |
59 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' \ |
|
59 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' \ | |
60 |
| grep '<guid' | sed 's|//[.a-zA-Z0-9 |
|
60 | | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
61 |
|
61 | |||
62 | cat > paths.conf <<EOF |
|
62 | cat > paths.conf <<EOF | |
63 | [paths] |
|
63 | [paths] | |
64 | t/a/=$root/a |
|
64 | t/a/=$root/a | |
65 | b=$root/b |
|
65 | b=$root/b | |
66 | coll=$root/* |
|
66 | coll=$root/* | |
67 | rcoll=$root/** |
|
67 | rcoll=$root/** | |
68 | EOF |
|
68 | EOF | |
69 |
|
69 | |||
70 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ |
|
70 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ | |
71 | -A access-paths.log -E error-paths-2.log |
|
71 | -A access-paths.log -E error-paths-2.log | |
72 | cat hg.pid >> $DAEMON_PIDS |
|
72 | cat hg.pid >> $DAEMON_PIDS | |
73 |
|
73 | |||
74 | echo % should succeed, slashy names |
|
74 | echo % should succeed, slashy names | |
75 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' |
|
75 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' | |
76 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \ |
|
76 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \ | |
77 | | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/" |
|
77 | | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/" | |
78 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw' |
|
78 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw' | |
79 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' |
|
79 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' | |
80 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \ |
|
80 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \ | |
81 | | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/" |
|
81 | | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/" | |
82 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \ |
|
82 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \ | |
83 | | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//" |
|
83 | | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//" | |
84 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \ |
|
84 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \ | |
85 | | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//" |
|
85 | | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//" | |
86 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw' |
|
86 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw' | |
87 | # Test [paths] '*' extension |
|
87 | # Test [paths] '*' extension | |
88 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw' |
|
88 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw' | |
89 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw' |
|
89 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw' | |
90 | #test [paths] '**' extension |
|
90 | #test [paths] '**' extension | |
91 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw' |
|
91 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw' | |
92 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw' |
|
92 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw' | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | "$TESTDIR/killdaemons.py" |
|
95 | "$TESTDIR/killdaemons.py" | |
96 | cat > paths.conf <<EOF |
|
96 | cat > paths.conf <<EOF | |
97 | [paths] |
|
97 | [paths] | |
98 | t/a = $root/a |
|
98 | t/a = $root/a | |
99 | t/b = $root/b |
|
99 | t/b = $root/b | |
100 | c = $root/c |
|
100 | c = $root/c | |
101 | [web] |
|
101 | [web] | |
102 | descend=false |
|
102 | descend=false | |
103 | EOF |
|
103 | EOF | |
104 |
|
104 | |||
105 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ |
|
105 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ | |
106 | -A access-paths.log -E error-paths-3.log |
|
106 | -A access-paths.log -E error-paths-3.log | |
107 | cat hg.pid >> $DAEMON_PIDS |
|
107 | cat hg.pid >> $DAEMON_PIDS | |
108 | echo % test descend = False |
|
108 | echo % test descend = False | |
109 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' |
|
109 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' | |
110 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' |
|
110 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' | |
111 |
|
111 | |||
112 |
|
112 | |||
113 | cat > collections.conf <<EOF |
|
113 | cat > collections.conf <<EOF | |
114 | [collections] |
|
114 | [collections] | |
115 | $root=$root |
|
115 | $root=$root | |
116 | EOF |
|
116 | EOF | |
117 |
|
117 | |||
118 | hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \ |
|
118 | hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \ | |
119 | --pid-file=hg.pid --webdir-conf collections.conf \ |
|
119 | --pid-file=hg.pid --webdir-conf collections.conf \ | |
120 | -A access-collections.log -E error-collections.log |
|
120 | -A access-collections.log -E error-collections.log | |
121 | cat hg.pid >> $DAEMON_PIDS |
|
121 | cat hg.pid >> $DAEMON_PIDS | |
122 |
|
122 | |||
123 | echo % collections: should succeed |
|
123 | echo % collections: should succeed | |
124 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw' |
|
124 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw' | |
125 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw' |
|
125 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw' | |
126 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw' |
|
126 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw' | |
127 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw' |
|
127 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw' | |
128 |
|
128 | |||
129 | echo % atom-log with basedir / |
|
129 | echo % atom-log with basedir / | |
130 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \ |
|
130 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \ | |
131 |
| grep '<link' | sed 's|//[.a-zA-Z0-9 |
|
131 | | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
132 |
|
132 | |||
133 | echo % rss-log with basedir / |
|
133 | echo % rss-log with basedir / | |
134 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \ |
|
134 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \ | |
135 |
| grep '<guid' | sed 's|//[.a-zA-Z0-9 |
|
135 | | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
136 |
|
136 | |||
137 | "$TESTDIR/killdaemons.py" |
|
137 | "$TESTDIR/killdaemons.py" | |
138 |
|
138 | |||
139 | hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \ |
|
139 | hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \ | |
140 | --pid-file=hg.pid --webdir-conf collections.conf \ |
|
140 | --pid-file=hg.pid --webdir-conf collections.conf \ | |
141 | -A access-collections-2.log -E error-collections-2.log |
|
141 | -A access-collections-2.log -E error-collections-2.log | |
142 | cat hg.pid >> $DAEMON_PIDS |
|
142 | cat hg.pid >> $DAEMON_PIDS | |
143 |
|
143 | |||
144 | echo % atom-log with basedir /foo/ |
|
144 | echo % atom-log with basedir /foo/ | |
145 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \ |
|
145 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \ | |
146 |
| grep '<link' | sed 's|//[.a-zA-Z0-9 |
|
146 | | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
147 |
|
147 | |||
148 | echo % rss-log with basedir /foo/ |
|
148 | echo % rss-log with basedir /foo/ | |
149 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \ |
|
149 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \ | |
150 |
| grep '<guid' | sed 's|//[.a-zA-Z0-9 |
|
150 | | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
151 |
|
151 | |||
152 | echo % paths errors 1 |
|
152 | echo % paths errors 1 | |
153 | cat error-paths-1.log |
|
153 | cat error-paths-1.log | |
154 | echo % paths errors 2 |
|
154 | echo % paths errors 2 | |
155 | cat error-paths-2.log |
|
155 | cat error-paths-2.log | |
156 | echo % paths errors 3 |
|
156 | echo % paths errors 3 | |
157 | cat error-paths-3.log |
|
157 | cat error-paths-3.log | |
158 | echo % collections errors |
|
158 | echo % collections errors | |
159 | cat error-collections.log |
|
159 | cat error-collections.log | |
160 | echo % collections errors 2 |
|
160 | echo % collections errors 2 | |
161 | cat error-collections-2.log |
|
161 | cat error-collections-2.log |
General Comments 0
You need to be logged in to leave comments.
Login now