##// END OF EJS Templates
tests: unify test-hgwebdir
Matt Mackall -
r12443:8dfdf021 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (759 lines changed) Show them Hide them
@@ -1,181 +1,648 b''
1 #!/bin/sh
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
3 # collection, different forms of 404s and the subdirectory support.
1 Tests some basic hgwebdir functionality. Tests setting up paths and
2 collection, different forms of 404s and the subdirectory support.
3
4 $ mkdir webdir
5 $ cd webdir
6 $ hg init a
7 $ echo a > a/a
8 $ hg --cwd a ci -Ama -d'1 0'
9 adding a
4 10
5 mkdir webdir
6 cd webdir
11 create a mercurial queue repository
12
13 $ hg --cwd a qinit --config extensions.hgext.mq= -c
14 $ hg init b
15 $ echo b > b/b
16 $ hg --cwd b ci -Amb -d'2 0'
17 adding b
18
19 create a nested repository
7 20
8 hg init a
9 echo a > a/a
10 hg --cwd a ci -Ama -d'1 0'
11 # create a mercurial queue repository
12 hg --cwd a qinit --config extensions.hgext.mq= -c
21 $ cd b
22 $ hg init d
23 $ echo d > d/d
24 $ hg --cwd d ci -Amd -d'3 0'
25 adding d
26 $ cd ..
27 $ hg init c
28 $ echo c > c/c
29 $ hg --cwd c ci -Amc -d'3 0'
30 adding c
31
32 create repository without .hg/store
13 33
14 hg init b
15 echo b > b/b
16 hg --cwd b ci -Amb -d'2 0'
34 $ hg init nostore
35 $ rm -R nostore/.hg/store
36 $ root=`pwd`
37 $ cd ..
38 $ cat > paths.conf <<EOF
39 > [paths]
40 > a=$root/a
41 > b=$root/b
42 > EOF
43 $ hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
44 > -A access-paths.log -E error-paths-1.log
45 $ cat hg.pid >> $DAEMON_PIDS
46
47 should give a 404 - file does not exist
48
49 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
50 404 Not Found
51
52
53 error: bork@8580ff50825a: not found in manifest
54 [1]
17 55
18 # create a nested repository
19 cd b
20 hg init d
21 echo d > d/d
22 hg --cwd d ci -Amd -d'3 0'
23 cd ..
56 should succeed
57
58 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
59 200 Script output follows
60
61
62 /a/
63 /b/
64
65 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
66 200 Script output follows
67
68 a
69 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
70 200 Script output follows
71
72 b
73
74 should give a 404 - repo is not published
75
76 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
77 404 Not Found
78
79
80 error: repository c not found
81 [1]
24 82
25 hg init c
26 echo c > c/c
27 hg --cwd c ci -Amc -d'3 0'
83 atom-log without basedir
84
85 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' | grep '<link'
86 <link rel="self" href="http://*/a/atom-log"/> (glob)
87 <link rel="alternate" href="http://*/a/"/> (glob)
88 <link href="http://*/a/rev/8580ff50825a"/> (glob)
89
90 rss-log without basedir
28 91
29 # create repository without .hg/store
30 hg init nostore
31 rm -R nostore/.hg/store
92 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' | grep '<guid'
93 <guid isPermaLink="true">http://*/a/rev/8580ff50825a</guid> (glob)
94 $ cat > paths.conf <<EOF
95 > [paths]
96 > t/a/=$root/a
97 > b=$root/b
98 > coll=$root/*
99 > rcoll=$root/**
100 > star=*
101 > starstar=**
102 > EOF
103 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
104 > -A access-paths.log -E error-paths-2.log
105 $ cat hg.pid >> $DAEMON_PIDS
32 106
33 root=`pwd`
34 cd ..
107 should succeed, slashy names
108
109 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
110 200 Script output follows
35 111
36 112
37 cat > paths.conf <<EOF
38 [paths]
39 a=$root/a
40 b=$root/b
41 EOF
113 /t/a/
114 /b/
115 /coll/a/
116 /coll/a/.hg/patches/
117 /coll/b/
118 /coll/c/
119 /rcoll/a/
120 /rcoll/a/.hg/patches/
121 /rcoll/b/
122 /rcoll/b/d/
123 /rcoll/c/
124 /star/webdir/a/
125 /star/webdir/a/.hg/patches/
126 /star/webdir/b/
127 /star/webdir/c/
128 /starstar/webdir/a/
129 /starstar/webdir/a/.hg/patches/
130 /starstar/webdir/b/
131 /starstar/webdir/b/d/
132 /starstar/webdir/c/
133
134 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper'
135 200 Script output follows
42 136
43 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
44 -A access-paths.log -E error-paths-1.log
45 cat hg.pid >> $DAEMON_PIDS
137 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
138 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
139 <head>
140 <link rel="icon" href="/static/hgicon.png" type="image/png" />
141 <meta name="robots" content="index, nofollow" />
142 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
143
144 <title>Mercurial repositories index</title>
145 </head>
146 <body>
46 147
47 echo % should give a 404 - file does not exist
48 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
148 <div class="container">
149 <div class="menu">
150 <a href="http://mercurial.selenic.com/">
151 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
152 </div>
153 <div class="main">
154 <h2>Mercurial Repositories</h2>
155
156 <table class="bigtable">
157 <tr>
158 <th><a href="?sort=name">Name</a></th>
159 <th><a href="?sort=description">Description</a></th>
160 <th><a href="?sort=contact">Contact</a></th>
161 <th><a href="?sort=lastchange">Last modified</a></th>
162 <th>&nbsp;</th>
163 </tr>
49 164
50 echo % should succeed
51 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
52 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
53 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
165 <tr class="parity0">
166 <td><a href="/t/a/?style=paper">t/a</a></td>
167 <td>unknown</td>
168 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
169 <td class="age">* ago</td> (glob)
170 <td class="indexlinks"></td>
171 </tr>
54 172
55 echo % should give a 404 - repo is not published
56 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
173 <tr class="parity1">
174 <td><a href="/b/?style=paper">b</a></td>
175 <td>unknown</td>
176 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
177 <td class="age">* ago</td> (glob)
178 <td class="indexlinks"></td>
179 </tr>
180
181 <tr class="parity0">
182 <td><a href="/coll/a/?style=paper">coll/a</a></td>
183 <td>unknown</td>
184 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
185 <td class="age">* ago</td> (glob)
186 <td class="indexlinks"></td>
187 </tr>
57 188
58 echo % atom-log without basedir
59 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' \
60 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
189 <tr class="parity1">
190 <td><a href="/coll/a/.hg/patches/?style=paper">coll/a/.hg/patches</a></td>
191 <td>unknown</td>
192 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
193 <td class="age">* ago</td> (glob)
194 <td class="indexlinks"></td>
195 </tr>
196
197 <tr class="parity0">
198 <td><a href="/coll/b/?style=paper">coll/b</a></td>
199 <td>unknown</td>
200 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
201 <td class="age">* ago</td> (glob)
202 <td class="indexlinks"></td>
203 </tr>
61 204
62 echo % rss-log without basedir
63 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' \
64 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
205 <tr class="parity1">
206 <td><a href="/coll/c/?style=paper">coll/c</a></td>
207 <td>unknown</td>
208 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
209 <td class="age">* ago</td> (glob)
210 <td class="indexlinks"></td>
211 </tr>
212
213 <tr class="parity0">
214 <td><a href="/rcoll/a/?style=paper">rcoll/a</a></td>
215 <td>unknown</td>
216 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
217 <td class="age">* ago</td> (glob)
218 <td class="indexlinks"></td>
219 </tr>
65 220
66 cat > paths.conf <<EOF
67 [paths]
68 t/a/=$root/a
69 b=$root/b
70 coll=$root/*
71 rcoll=$root/**
72 star=*
73 starstar=**
74 EOF
221 <tr class="parity1">
222 <td><a href="/rcoll/a/.hg/patches/?style=paper">rcoll/a/.hg/patches</a></td>
223 <td>unknown</td>
224 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
225 <td class="age">* ago</td> (glob)
226 <td class="indexlinks"></td>
227 </tr>
228
229 <tr class="parity0">
230 <td><a href="/rcoll/b/?style=paper">rcoll/b</a></td>
231 <td>unknown</td>
232 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
233 <td class="age">* ago</td> (glob)
234 <td class="indexlinks"></td>
235 </tr>
236
237 <tr class="parity1">
238 <td><a href="/rcoll/b/d/?style=paper">rcoll/b/d</a></td>
239 <td>unknown</td>
240 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
241 <td class="age">* ago</td> (glob)
242 <td class="indexlinks"></td>
243 </tr>
75 244
76 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
77 -A access-paths.log -E error-paths-2.log
78 cat hg.pid >> $DAEMON_PIDS
245 <tr class="parity0">
246 <td><a href="/rcoll/c/?style=paper">rcoll/c</a></td>
247 <td>unknown</td>
248 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
249 <td class="age">* ago</td> (glob)
250 <td class="indexlinks"></td>
251 </tr>
252
253 <tr class="parity1">
254 <td><a href="/star/webdir/a/?style=paper">star/webdir/a</a></td>
255 <td>unknown</td>
256 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
257 <td class="age">* ago</td> (glob)
258 <td class="indexlinks"></td>
259 </tr>
260
261 <tr class="parity0">
262 <td><a href="/star/webdir/a/.hg/patches/?style=paper">star/webdir/a/.hg/patches</a></td>
263 <td>unknown</td>
264 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
265 <td class="age">* ago</td> (glob)
266 <td class="indexlinks"></td>
267 </tr>
268
269 <tr class="parity1">
270 <td><a href="/star/webdir/b/?style=paper">star/webdir/b</a></td>
271 <td>unknown</td>
272 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
273 <td class="age">* ago</td> (glob)
274 <td class="indexlinks"></td>
275 </tr>
79 276
80 echo % should succeed, slashy names
81 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
82 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \
83 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
84 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
85 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
86 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \
87 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
88 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
89 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
90 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
91 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
92 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
93 # Test [paths] '*' extension
94 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw'
95 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw'
96 #test [paths] '**' extension
97 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
98 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw'
277 <tr class="parity0">
278 <td><a href="/star/webdir/c/?style=paper">star/webdir/c</a></td>
279 <td>unknown</td>
280 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
281 <td class="age">* ago</td> (glob)
282 <td class="indexlinks"></td>
283 </tr>
284
285 <tr class="parity1">
286 <td><a href="/starstar/webdir/a/?style=paper">starstar/webdir/a</a></td>
287 <td>unknown</td>
288 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
289 <td class="age">* ago</td> (glob)
290 <td class="indexlinks"></td>
291 </tr>
292
293 <tr class="parity0">
294 <td><a href="/starstar/webdir/a/.hg/patches/?style=paper">starstar/webdir/a/.hg/patches</a></td>
295 <td>unknown</td>
296 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
297 <td class="age">* ago</td> (glob)
298 <td class="indexlinks"></td>
299 </tr>
300
301 <tr class="parity1">
302 <td><a href="/starstar/webdir/b/?style=paper">starstar/webdir/b</a></td>
303 <td>unknown</td>
304 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
305 <td class="age">* ago</td> (glob)
306 <td class="indexlinks"></td>
307 </tr>
308
309 <tr class="parity0">
310 <td><a href="/starstar/webdir/b/d/?style=paper">starstar/webdir/b/d</a></td>
311 <td>unknown</td>
312 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
313 <td class="age">* ago</td> (glob)
314 <td class="indexlinks"></td>
315 </tr>
316
317 <tr class="parity1">
318 <td><a href="/starstar/webdir/c/?style=paper">starstar/webdir/c</a></td>
319 <td>unknown</td>
320 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
321 <td class="age">* ago</td> (glob)
322 <td class="indexlinks"></td>
323 </tr>
324
325 </table>
326 </div>
327 </div>
328
329
330 </body>
331 </html>
332
333 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
334 200 Script output follows
335
336
337 /t/a/
338
339 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
340 200 Script output follows
99 341
100 342
101 "$TESTDIR/killdaemons.py"
102 cat > paths.conf <<EOF
103 [paths]
104 t/a = $root/a
105 t/b = $root/b
106 c = $root/c
107 [web]
108 descend=false
109 EOF
343 /t/a/
344
345 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper'
346 200 Script output follows
347
348 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
349 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
350 <head>
351 <link rel="icon" href="/static/hgicon.png" type="image/png" />
352 <meta name="robots" content="index, nofollow" />
353 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
354
355 <title>Mercurial repositories index</title>
356 </head>
357 <body>
110 358
111 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
112 -A access-paths.log -E error-paths-3.log
113 cat hg.pid >> $DAEMON_PIDS
114 echo % test descend = False
115 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
116 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
359 <div class="container">
360 <div class="menu">
361 <a href="http://mercurial.selenic.com/">
362 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
363 </div>
364 <div class="main">
365 <h2>Mercurial Repositories</h2>
366
367 <table class="bigtable">
368 <tr>
369 <th><a href="?sort=name">Name</a></th>
370 <th><a href="?sort=description">Description</a></th>
371 <th><a href="?sort=contact">Contact</a></th>
372 <th><a href="?sort=lastchange">Last modified</a></th>
373 <th>&nbsp;</th>
374 </tr>
375
376 <tr class="parity0">
377 <td><a href="/t/a/?style=paper">a</a></td>
378 <td>unknown</td>
379 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
380 <td class="age">* ago</td> (glob)
381 <td class="indexlinks"></td>
382 </tr>
383
384 </table>
385 </div>
386 </div>
117 387
118 388
119 "$TESTDIR/killdaemons.py"
120 cat > paths.conf <<EOF
121 [paths]
122 nostore = $root/nostore
123 inexistent = $root/inexistent
124 EOF
389 </body>
390 </html>
391
392 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom'
393 200 Script output follows
394
395 <?xml version="1.0" encoding="ascii"?>
396 <feed xmlns="http://www.w3.org/2005/Atom">
397 <!-- Changelog -->
398 <id>http://*/t/a/</id> (glob)
399 <link rel="self" href="http://*/t/a/atom-log"/> (glob)
400 <link rel="alternate" href="http://*/t/a/"/> (glob)
401 <title>t/a Changelog</title>
402 <updated>1970-01-01T00:00:01+00:00</updated>
403
404 <entry>
405 <title>a</title>
406 <id>http://*/t/a/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id> (glob)
407 <link href="http://*/t/a/rev/8580ff50825a"/> (glob)
408 <author>
409 <name>test</name>
410 <email>&#116;&#101;&#115;&#116;</email>
411 </author>
412 <updated>1970-01-01T00:00:01+00:00</updated>
413 <published>1970-01-01T00:00:01+00:00</published>
414 <content type="xhtml">
415 <div xmlns="http://www.w3.org/1999/xhtml">
416 <pre xml:space="preserve">a</pre>
417 </div>
418 </content>
419 </entry>
420
421 </feed>
422 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom'
423 200 Script output follows
125 424
126 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
127 -A access-paths.log -E error-paths-4.log
128 cat hg.pid >> $DAEMON_PIDS
129 echo % test inexistent and inaccessible repo should be ignored silently
130 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/'
425 <?xml version="1.0" encoding="ascii"?>
426 <feed xmlns="http://www.w3.org/2005/Atom">
427 <!-- Changelog -->
428 <id>http://*/t/a/</id> (glob)
429 <link rel="self" href="http://*/t/a/atom-log"/> (glob)
430 <link rel="alternate" href="http://*/t/a/"/> (glob)
431 <title>t/a Changelog</title>
432 <updated>1970-01-01T00:00:01+00:00</updated>
433
434 <entry>
435 <title>a</title>
436 <id>http://*/t/a/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id> (glob)
437 <link href="http://*/t/a/rev/8580ff50825a"/> (glob)
438 <author>
439 <name>test</name>
440 <email>&#116;&#101;&#115;&#116;</email>
441 </author>
442 <updated>1970-01-01T00:00:01+00:00</updated>
443 <published>1970-01-01T00:00:01+00:00</published>
444 <content type="xhtml">
445 <div xmlns="http://www.w3.org/1999/xhtml">
446 <pre xml:space="preserve">a</pre>
447 </div>
448 </content>
449 </entry>
450
451 </feed>
452 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
453 200 Script output follows
454
455 a
456
457 Test [paths] '*' extension
458
459 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw'
460 200 Script output follows
461
462
463 /coll/a/
464 /coll/a/.hg/patches/
465 /coll/b/
466 /coll/c/
467
468 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw'
469 200 Script output follows
470
471 a
472
473 est [paths] '**' extension
474
475 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
476 200 Script output follows
131 477
132 478
133 cat > collections.conf <<EOF
134 [collections]
135 $root=$root
136 EOF
479 /rcoll/a/
480 /rcoll/a/.hg/patches/
481 /rcoll/b/
482 /rcoll/b/d/
483 /rcoll/c/
484
485 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw'
486 200 Script output follows
137 487
138 hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \
139 --pid-file=hg.pid --webdir-conf collections.conf \
140 -A access-collections.log -E error-collections.log
141 cat hg.pid >> $DAEMON_PIDS
488 d
489 $ "$TESTDIR/killdaemons.py"
490 $ cat > paths.conf <<EOF
491 > [paths]
492 > t/a = $root/a
493 > t/b = $root/b
494 > c = $root/c
495 > [web]
496 > descend=false
497 > EOF
498 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
499 > -A access-paths.log -E error-paths-3.log
500 $ cat hg.pid >> $DAEMON_PIDS
501
502 test descend = False
503
504 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
505 200 Script output follows
506
507
508 /c/
509
510 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
511 200 Script output follows
512
513
514 /t/a/
515 /t/b/
142 516
143 echo % collections: should succeed
144 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
145 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
146 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
147 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
517 $ "$TESTDIR/killdaemons.py"
518 $ cat > paths.conf <<EOF
519 > [paths]
520 > nostore = $root/nostore
521 > inexistent = $root/inexistent
522 > EOF
523 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
524 > -A access-paths.log -E error-paths-4.log
525 $ cat hg.pid >> $DAEMON_PIDS
526
527 test inexistent and inaccessible repo should be ignored silently
528
529 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/'
530 200 Script output follows
531
532 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
533 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
534 <head>
535 <link rel="icon" href="/static/hgicon.png" type="image/png" />
536 <meta name="robots" content="index, nofollow" />
537 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
148 538
149 echo % atom-log with basedir /
150 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \
151 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
539 <title>Mercurial repositories index</title>
540 </head>
541 <body>
542
543 <div class="container">
544 <div class="menu">
545 <a href="http://mercurial.selenic.com/">
546 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
547 </div>
548 <div class="main">
549 <h2>Mercurial Repositories</h2>
152 550
153 echo % rss-log with basedir /
154 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \
155 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
551 <table class="bigtable">
552 <tr>
553 <th><a href="?sort=name">Name</a></th>
554 <th><a href="?sort=description">Description</a></th>
555 <th><a href="?sort=contact">Contact</a></th>
556 <th><a href="?sort=lastchange">Last modified</a></th>
557 <th>&nbsp;</th>
558 </tr>
559
560 </table>
561 </div>
562 </div>
156 563
157 "$TESTDIR/killdaemons.py"
564
565 </body>
566 </html>
567
568 $ cat > collections.conf <<EOF
569 > [collections]
570 > $root=$root
571 > EOF
572 $ hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \
573 > --pid-file=hg.pid --webdir-conf collections.conf \
574 > -A access-collections.log -E error-collections.log
575 $ cat hg.pid >> $DAEMON_PIDS
576
577 collections: should succeed
578
579 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
580 200 Script output follows
581
158 582
159 hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \
160 --pid-file=hg.pid --webdir-conf collections.conf \
161 -A access-collections-2.log -E error-collections-2.log
162 cat hg.pid >> $DAEMON_PIDS
583 /a/
584 /a/.hg/patches/
585 /b/
586 /c/
587
588 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
589 200 Script output follows
163 590
164 echo % atom-log with basedir /foo/
165 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \
166 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
591 a
592 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
593 200 Script output follows
594
595 b
596 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
597 200 Script output follows
598
599 c
600
601 atom-log with basedir /
167 602
168 echo % rss-log with basedir /foo/
169 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \
170 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
603 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' | grep '<link'
604 <link rel="self" href="http://hg.example.com:8080/a/atom-log"/>
605 <link rel="alternate" href="http://hg.example.com:8080/a/"/>
606 <link href="http://hg.example.com:8080/a/rev/8580ff50825a"/>
607
608 rss-log with basedir /
609
610 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' | grep '<guid'
611 <guid isPermaLink="true">http://hg.example.com:8080/a/rev/8580ff50825a</guid>
612 $ "$TESTDIR/killdaemons.py"
613 $ hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \
614 > --pid-file=hg.pid --webdir-conf collections.conf \
615 > -A access-collections-2.log -E error-collections-2.log
616 $ cat hg.pid >> $DAEMON_PIDS
617
618 atom-log with basedir /foo/
619
620 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' | grep '<link'
621 <link rel="self" href="http://hg.example.com:8080/foo/a/atom-log"/>
622 <link rel="alternate" href="http://hg.example.com:8080/foo/a/"/>
623 <link href="http://hg.example.com:8080/foo/a/rev/8580ff50825a"/>
171 624
172 echo % paths errors 1
173 cat error-paths-1.log
174 echo % paths errors 2
175 cat error-paths-2.log
176 echo % paths errors 3
177 cat error-paths-3.log
178 echo % collections errors
179 cat error-collections.log
180 echo % collections errors 2
181 cat error-collections-2.log
625 rss-log with basedir /foo/
626
627 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' | grep '<guid'
628 <guid isPermaLink="true">http://hg.example.com:8080/foo/a/rev/8580ff50825a</guid>
629
630 paths errors 1
631
632 $ cat error-paths-1.log
633
634 paths errors 2
635
636 $ cat error-paths-2.log
637
638 paths errors 3
639
640 $ cat error-paths-3.log
641
642 collections errors
643
644 $ cat error-collections.log
645
646 collections errors 2
647
648 $ cat error-collections-2.log
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now