Mercurial > hg
annotate tests/test-hgweb.t @ 15164:7bddec632821
patchbomb: make it easy for the user to decline sending an intro message.
- prompt(): respect interactive mode; clarify logic a bit
- rename introneeded() to introwanted() and give it only one caller
- add 'numbered' arg to makepatch() so it does not need to call
introwanted()
- factor makeintro() out of getpatchmsgs(), so it's easier to skip the
intro message based on the user's behaviour
Unexpected but perfectly reasonable side effect: in non-interactive
mode, we don't show unanswerable "Cc" or "From" prompts anymore, so
remove those from the test expectations.
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Tue, 27 Sep 2011 22:38:47 -0400 |
parents | b24e5a708fad |
children | c5c9ca3719f9 |
rev | line source |
---|---|
12432 | 1 Some tests for hgweb. Tests static files, plain files and different 404's. |
2 | |
3 $ hg init test | |
4 $ cd test | |
5 $ mkdir da | |
6 $ echo foo > da/foo | |
7 $ echo foo > foo | |
8 $ hg ci -Ambase | |
9 adding da/foo | |
10 adding foo | |
11 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
12 $ cat hg.pid >> $DAEMON_PIDS | |
13 | |
14 manifest | |
3942 | 15 |
12432 | 16 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') |
17 200 Script output follows | |
18 | |
19 | |
20 drwxr-xr-x da | |
21 -rw-r--r-- 4 foo | |
22 | |
23 | |
24 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') | |
25 200 Script output follows | |
26 | |
27 | |
28 -rw-r--r-- 4 foo | |
29 | |
30 | |
31 | |
32 plain file | |
33 | |
34 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' | |
35 200 Script output follows | |
36 | |
37 foo | |
38 | |
39 should give a 404 - static file that does not exist | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
40 |
12432 | 41 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' |
42 404 Not Found | |
43 | |
44 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
45 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
46 <head> | |
47 <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
48 <meta name="robots" content="index, nofollow" /> | |
49 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
50 <script type="text/javascript" src="/static/mercurial.js"></script> |
12432 | 51 |
52 <title>test: error</title> | |
53 </head> | |
54 <body> | |
55 | |
56 <div class="container"> | |
57 <div class="menu"> | |
58 <div class="logo"> | |
59 <a href="http://mercurial.selenic.com/"> | |
60 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> | |
61 </div> | |
62 <ul> | |
63 <li><a href="/shortlog">log</a></li> | |
64 <li><a href="/graph">graph</a></li> | |
65 <li><a href="/tags">tags</a></li> | |
13597
38c9837b1f75
hgweb: add separate page with bookmarks listing
Alexander Solovyov <alexander@solovyov.net>
parents:
12846
diff
changeset
|
66 <li><a href="/bookmarks">bookmarks</a></li> |
12432 | 67 <li><a href="/branches">branches</a></li> |
12680
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
68 <li><a href="/help">help</a></li> |
12432 | 69 </ul> |
70 </div> | |
71 | |
72 <div class="main"> | |
73 | |
74 <h2><a href="/">test</a></h2> | |
75 <h3>error</h3> | |
76 | |
77 <form class="search" action="/log"> | |
78 | |
79 <p><input name="rev" id="search1" type="text" size="30"></p> | |
80 <div id="hint">find changesets by author, revision, | |
81 files, or words in the commit message</div> | |
82 </form> | |
83 | |
84 <div class="description"> | |
85 <p> | |
86 An error occurred while processing your request: | |
87 </p> | |
88 <p> | |
89 Not Found | |
90 </p> | |
91 </div> | |
92 </div> | |
93 </div> | |
94 | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
95 <script type="text/javascript">process_dates()</script> |
12432 | 96 |
97 | |
98 </body> | |
99 </html> | |
100 | |
101 [1] | |
102 | |
103 should give a 404 - bad revision | |
104 | |
105 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' | |
106 404 Not Found | |
107 | |
108 | |
109 error: revision not found: spam | |
110 [1] | |
111 | |
112 should give a 400 - bad command | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
113 |
12432 | 114 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' |
115 400* (glob) | |
116 | |
117 | |
118 error: no such method: spam | |
119 [1] | |
120 | |
121 should give a 404 - file does not exist | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
122 |
12432 | 123 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' |
124 404 Not Found | |
125 | |
126 | |
127 error: bork@2ef0ac749a14: not found in manifest | |
128 [1] | |
129 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' | |
130 404 Not Found | |
131 | |
132 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
133 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
134 <head> | |
135 <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
136 <meta name="robots" content="index, nofollow" /> | |
137 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
138 <script type="text/javascript" src="/static/mercurial.js"></script> |
12432 | 139 |
140 <title>test: error</title> | |
141 </head> | |
142 <body> | |
143 | |
144 <div class="container"> | |
145 <div class="menu"> | |
146 <div class="logo"> | |
147 <a href="http://mercurial.selenic.com/"> | |
148 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> | |
149 </div> | |
150 <ul> | |
151 <li><a href="/shortlog">log</a></li> | |
152 <li><a href="/graph">graph</a></li> | |
153 <li><a href="/tags">tags</a></li> | |
13597
38c9837b1f75
hgweb: add separate page with bookmarks listing
Alexander Solovyov <alexander@solovyov.net>
parents:
12846
diff
changeset
|
154 <li><a href="/bookmarks">bookmarks</a></li> |
12432 | 155 <li><a href="/branches">branches</a></li> |
12680
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
156 <li><a href="/help">help</a></li> |
12432 | 157 </ul> |
158 </div> | |
159 | |
160 <div class="main"> | |
161 | |
162 <h2><a href="/">test</a></h2> | |
163 <h3>error</h3> | |
164 | |
165 <form class="search" action="/log"> | |
166 | |
167 <p><input name="rev" id="search1" type="text" size="30"></p> | |
168 <div id="hint">find changesets by author, revision, | |
169 files, or words in the commit message</div> | |
170 </form> | |
171 | |
172 <div class="description"> | |
173 <p> | |
174 An error occurred while processing your request: | |
175 </p> | |
176 <p> | |
177 bork@2ef0ac749a14: not found in manifest | |
178 </p> | |
179 </div> | |
180 </div> | |
181 </div> | |
182 | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
183 <script type="text/javascript">process_dates()</script> |
12432 | 184 |
185 | |
186 </body> | |
187 </html> | |
188 | |
189 [1] | |
190 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' | |
191 404 Not Found | |
192 | |
193 | |
194 error: bork@2ef0ac749a14: not found in manifest | |
195 [1] | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
196 |
12432 | 197 try bad style |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
198 |
12432 | 199 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=foobar') |
200 200 Script output follows | |
201 | |
202 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
203 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
204 <head> | |
205 <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
206 <meta name="robots" content="index, nofollow" /> | |
207 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
208 <script type="text/javascript" src="/static/mercurial.js"></script> |
12432 | 209 |
210 <title>test: 2ef0ac749a14 /</title> | |
211 </head> | |
212 <body> | |
213 | |
214 <div class="container"> | |
215 <div class="menu"> | |
216 <div class="logo"> | |
217 <a href="http://mercurial.selenic.com/"> | |
218 <img src="/static/hglogo.png" alt="mercurial" /></a> | |
219 </div> | |
220 <ul> | |
221 <li><a href="/shortlog/2ef0ac749a14">log</a></li> | |
222 <li><a href="/graph/2ef0ac749a14">graph</a></li> | |
223 <li><a href="/tags">tags</a></li> | |
13597
38c9837b1f75
hgweb: add separate page with bookmarks listing
Alexander Solovyov <alexander@solovyov.net>
parents:
12846
diff
changeset
|
224 <li><a href="/bookmarks">bookmarks</a></li> |
12432 | 225 <li><a href="/branches">branches</a></li> |
226 </ul> | |
227 <ul> | |
228 <li><a href="/rev/2ef0ac749a14">changeset</a></li> | |
229 <li class="active">browse</li> | |
230 </ul> | |
231 <ul> | |
232 | |
233 </ul> | |
12666
ead4e21f49f1
web: add a help view for getting hg help output
Augie Fackler <durin42@gmail.com>
parents:
12432
diff
changeset
|
234 <ul> |
ead4e21f49f1
web: add a help view for getting hg help output
Augie Fackler <durin42@gmail.com>
parents:
12432
diff
changeset
|
235 <li><a href="/help">help</a></li> |
ead4e21f49f1
web: add a help view for getting hg help output
Augie Fackler <durin42@gmail.com>
parents:
12432
diff
changeset
|
236 </ul> |
12432 | 237 </div> |
238 | |
239 <div class="main"> | |
240 <h2><a href="/">test</a></h2> | |
241 <h3>directory / @ 0:2ef0ac749a14 <span class="tag">tip</span> </h3> | |
242 | |
243 <form class="search" action="/log"> | |
244 | |
245 <p><input name="rev" id="search1" type="text" size="30" /></p> | |
246 <div id="hint">find changesets by author, revision, | |
247 files, or words in the commit message</div> | |
248 </form> | |
249 | |
250 <table class="bigtable"> | |
251 <tr> | |
252 <th class="name">name</th> | |
253 <th class="size">size</th> | |
254 <th class="permissions">permissions</th> | |
255 </tr> | |
256 <tr class="fileline parity0"> | |
257 <td class="name"><a href="/file/2ef0ac749a14/">[up]</a></td> | |
258 <td class="size"></td> | |
259 <td class="permissions">drwxr-xr-x</td> | |
260 </tr> | |
261 | |
262 <tr class="fileline parity1"> | |
263 <td class="name"> | |
264 <a href="/file/2ef0ac749a14/da"> | |
265 <img src="/static/coal-folder.png" alt="dir."/> da/ | |
266 </a> | |
267 <a href="/file/2ef0ac749a14/da/"> | |
268 | |
269 </a> | |
270 </td> | |
271 <td class="size"></td> | |
272 <td class="permissions">drwxr-xr-x</td> | |
273 </tr> | |
274 | |
275 <tr class="fileline parity0"> | |
276 <td class="filename"> | |
277 <a href="/file/2ef0ac749a14/foo"> | |
278 <img src="/static/coal-file.png" alt="file"/> foo | |
279 </a> | |
280 </td> | |
281 <td class="size">4</td> | |
282 <td class="permissions">-rw-r--r--</td> | |
283 </tr> | |
284 </table> | |
285 </div> | |
286 </div> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
287 <script type="text/javascript">process_dates()</script> |
12432 | 288 |
289 | |
290 </body> | |
291 </html> | |
292 | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
293 |
12432 | 294 stop and restart |
295 | |
296 $ "$TESTDIR/killdaemons.py" | |
297 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log | |
298 $ cat hg.pid >> $DAEMON_PIDS | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
299 |
12432 | 300 Test the access/error files are opened in append mode |
301 | |
302 $ python -c "print len(file('access.log').readlines()), 'log lines written'" | |
303 10 log lines written | |
304 | |
305 static file | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
306 |
12432 | 307 $ "$TESTDIR/get-with-headers.py" --twice localhost:$HGPORT '/static/style-gitweb.css' |
308 200 Script output follows | |
309 | |
310 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; } | |
311 a { color:#0000cc; } | |
312 a:hover, a:visited, a:active { color:#880000; } | |
313 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } | |
314 div.page_header a:visited { color:#0000cc; } | |
315 div.page_header a:hover { color:#880000; } | |
316 div.page_nav { padding:8px; } | |
317 div.page_nav a:visited { color:#0000cc; } | |
318 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} | |
319 div.page_footer { padding:4px 8px; background-color: #d9d8d1; } | |
320 div.page_footer_text { float:left; color:#555555; font-style:italic; } | |
321 div.page_body { padding:8px; } | |
322 div.title, a.title { | |
323 display:block; padding:6px 8px; | |
324 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; | |
325 } | |
326 a.title:hover { background-color: #d9d8d1; } | |
327 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } | |
328 div.log_body { padding:8px 8px 8px 150px; } | |
329 .age { white-space:nowrap; } | |
330 span.age { position:relative; float:left; width:142px; font-style:italic; } | |
331 div.log_link { | |
332 padding:0px 8px; | |
333 font-size:10px; font-family:sans-serif; font-style:normal; | |
334 position:relative; float:left; width:136px; | |
335 } | |
336 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } | |
337 a.list { text-decoration:none; color:#000000; } | |
338 a.list:hover { text-decoration:underline; color:#880000; } | |
339 table { padding:8px 4px; } | |
340 th { padding:2px 5px; font-size:12px; text-align:left; } | |
341 tr.light:hover, .parity0:hover { background-color:#edece6; } | |
342 tr.dark, .parity1 { background-color:#f6f6f0; } | |
343 tr.dark:hover, .parity1:hover { background-color:#edece6; } | |
344 td { padding:2px 5px; font-size:12px; vertical-align:top; } | |
345 td.closed { background-color: #99f; } | |
346 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } | |
347 td.indexlinks { white-space: nowrap; } | |
348 td.indexlinks a { | |
349 padding: 2px 5px; line-height: 10px; | |
350 border: 1px solid; | |
351 color: #ffffff; background-color: #7777bb; | |
352 border-color: #aaaadd #333366 #333366 #aaaadd; | |
353 font-weight: bold; text-align: center; text-decoration: none; | |
354 font-size: 10px; | |
355 } | |
356 td.indexlinks a:hover { background-color: #6666aa; } | |
357 div.pre { font-family:monospace; font-size:12px; white-space:pre; } | |
358 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } | |
359 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } | |
360 div.search { margin:4px 8px; position:absolute; top:56px; right:12px } | |
361 .linenr { color:#999999; text-decoration:none } | |
362 div.rss_logo { float: right; white-space: nowrap; } | |
363 div.rss_logo a { | |
364 padding:3px 6px; line-height:10px; | |
365 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; | |
366 color:#ffffff; background-color:#ff6600; | |
367 font-weight:bold; font-family:sans-serif; font-size:10px; | |
368 text-align:center; text-decoration:none; | |
369 } | |
370 div.rss_logo a:hover { background-color:#ee5500; } | |
371 pre { margin: 0; } | |
372 span.logtags span { | |
373 padding: 0px 4px; | |
374 font-size: 10px; | |
375 font-weight: normal; | |
376 border: 1px solid; | |
377 background-color: #ffaaff; | |
378 border-color: #ffccff #ff00ee #ff00ee #ffccff; | |
379 } | |
380 span.logtags span.tagtag { | |
381 background-color: #ffffaa; | |
382 border-color: #ffffcc #ffee00 #ffee00 #ffffcc; | |
383 } | |
384 span.logtags span.branchtag { | |
385 background-color: #aaffaa; | |
386 border-color: #ccffcc #00cc33 #00cc33 #ccffcc; | |
387 } | |
388 span.logtags span.inbranchtag { | |
389 background-color: #d5dde6; | |
390 border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4; | |
391 } | |
13863
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
392 span.logtags span.bookmarktag { |
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
393 background-color: #afdffa; |
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
394 border-color: #ccecff #46ace6 #46ace6 #ccecff; |
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
395 } |
12432 | 396 |
397 /* Graph */ | |
398 div#wrapper { | |
399 position: relative; | |
400 margin: 0; | |
401 padding: 0; | |
402 margin-top: 3px; | |
403 } | |
404 | |
405 canvas { | |
406 position: absolute; | |
407 z-index: 5; | |
408 top: -0.9em; | |
409 margin: 0; | |
410 } | |
411 | |
412 ul#nodebgs { | |
413 list-style: none inside none; | |
414 padding: 0; | |
415 margin: 0; | |
416 top: -0.7em; | |
417 } | |
418 | |
419 ul#graphnodes li, ul#nodebgs li { | |
420 height: 39px; | |
421 } | |
422 | |
423 ul#graphnodes { | |
424 position: absolute; | |
425 z-index: 10; | |
426 top: -0.8em; | |
427 list-style: none inside none; | |
428 padding: 0; | |
429 } | |
430 | |
431 ul#graphnodes li .info { | |
432 display: block; | |
433 font-size: 100%; | |
434 position: relative; | |
435 top: -3px; | |
436 font-style: italic; | |
437 } | |
438 304 Not Modified | |
439 | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
440 |
12432 | 441 errors |
5690
1b365c5723bc
server: append to logfiles
Mirko Friedenhagen <mirko-lists@friedenhagen.de>
parents:
5580
diff
changeset
|
442 |
12432 | 443 $ cat errors.log |