Debian Codegraph @

tests/test-hgweb.t

raw
1 #require serve
2
3 Some tests for hgweb. Tests static files, plain files and different 404's.
4
5 $ hg init test
6 $ cd test
7 $ mkdir da
8 $ echo foo > da/foo
9 $ echo foo > foo
10 $ hg ci -Ambase
11 adding da/foo
12 adding foo
13 $ hg bookmark -r0 '@'
14 $ hg bookmark -r0 'a b c'
15 $ hg bookmark -r0 'd/e/f'
16 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
17 $ cat hg.pid >> $DAEMON_PIDS
18
19 manifest
20
21 $ (get-with-headers.py localhost:$HGPORT 'file/tip/?style=raw')
22 200 Script output follows
23
24
25 drwxr-xr-x da
26 -rw-r--r-- 4 foo
27
28
29 $ (get-with-headers.py localhost:$HGPORT 'file/tip/da?style=raw')
30 200 Script output follows
31
32
33 -rw-r--r-- 4 foo
34
35
36
37 plain file
38
39 $ get-with-headers.py localhost:$HGPORT 'file/tip/foo?style=raw'
40 200 Script output follows
41
42 foo
43
44 should give a 404 - static file that does not exist
45
46 $ get-with-headers.py localhost:$HGPORT 'static/bogus'
47 404 Not Found
48
49 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
50 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
51 <head>
52 <link rel="icon" href="/static/hgicon.png" type="image/png" />
53 <meta name="robots" content="index, nofollow" />
54 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
55 <script type="text/javascript" src="/static/mercurial.js"></script>
56
57 <title>test: error</title>
58 </head>
59 <body>
60
61 <div class="container">
62 <div class="menu">
63 <div class="logo">
64 <a href="https://mercurial-scm.org/">
65 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
66 </div>
67 <ul>
68 <li><a href="/shortlog">log</a></li>
69 <li><a href="/graph">graph</a></li>
70 <li><a href="/tags">tags</a></li>
71 <li><a href="/bookmarks">bookmarks</a></li>
72 <li><a href="/branches">branches</a></li>
73 </ul>
74 <ul>
75 <li><a href="/help">help</a></li>
76 </ul>
77 </div>
78
79 <div class="main">
80
81 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
82 <h3>error</h3>
83
84
85 <form class="search" action="/log">
86
87 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
88 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
89 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
90 </form>
91
92 <div class="description">
93 <p>
94 An error occurred while processing your request:
95 </p>
96 <p>
97 Not Found
98 </p>
99 </div>
100 </div>
101 </div>
102
103
104
105 </body>
106 </html>
107
108 [1]
109
110 should give a 404 - bad revision
111
112 $ get-with-headers.py localhost:$HGPORT 'file/spam/foo?style=raw'
113 404 Not Found
114
115
116 error: revision not found: spam
117 [1]
118
119 should give a 400 - bad command
120
121 $ get-with-headers.py localhost:$HGPORT 'file/tip/foo?cmd=spam&style=raw'
122 400* (glob)
123
124
125 error: method not found
126 [1]
127
128 $ get-with-headers.py --headeronly localhost:$HGPORT '?cmd=spam'
129 400 method not found
130 [1]
131
132 should give a 400 - bad command as a part of url path (issue4071)
133
134 $ get-with-headers.py --headeronly localhost:$HGPORT 'spam'
135 400 method not found
136 [1]
137
138 $ get-with-headers.py --headeronly localhost:$HGPORT 'raw-spam'
139 400 method not found
140 [1]
141
142 $ get-with-headers.py --headeronly localhost:$HGPORT 'spam/tip/foo'
143 400 method not found
144 [1]
145
146 should give a 404 - file does not exist
147
148 $ get-with-headers.py localhost:$HGPORT 'file/tip/bork?style=raw'
149 404 Not Found
150
151
152 error: bork@2ef0ac749a14e4f57a5a822464a0902c6f7f448f: not found in manifest
153 [1]
154 $ get-with-headers.py localhost:$HGPORT 'file/tip/bork'
155 404 Not Found
156
157 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
158 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
159 <head>
160 <link rel="icon" href="/static/hgicon.png" type="image/png" />
161 <meta name="robots" content="index, nofollow" />
162 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
163 <script type="text/javascript" src="/static/mercurial.js"></script>
164
165 <title>test: error</title>
166 </head>
167 <body>
168
169 <div class="container">
170 <div class="menu">
171 <div class="logo">
172 <a href="https://mercurial-scm.org/">
173 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
174 </div>
175 <ul>
176 <li><a href="/shortlog">log</a></li>
177 <li><a href="/graph">graph</a></li>
178 <li><a href="/tags">tags</a></li>
179 <li><a href="/bookmarks">bookmarks</a></li>
180 <li><a href="/branches">branches</a></li>
181 </ul>
182 <ul>
183 <li><a href="/help">help</a></li>
184 </ul>
185 </div>
186
187 <div class="main">
188
189 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
190 <h3>error</h3>
191
192
193 <form class="search" action="/log">
194
195 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
196 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
197 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
198 </form>
199
200 <div class="description">
201 <p>
202 An error occurred while processing your request:
203 </p>
204 <p>
205 bork@2ef0ac749a14e4f57a5a822464a0902c6f7f448f: not found in manifest
206 </p>
207 </div>
208 </div>
209 </div>
210
211
212
213 </body>
214 </html>
215
216 [1]
217 $ get-with-headers.py localhost:$HGPORT 'diff/tip/bork?style=raw'
218 404 Not Found
219
220
221 error: bork@2ef0ac749a14e4f57a5a822464a0902c6f7f448f: not found in manifest
222 [1]
223
224 try bad style
225
226 $ (get-with-headers.py localhost:$HGPORT 'file/tip/?style=foobar')
227 200 Script output follows
228
229 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
230 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
231 <head>
232 <link rel="icon" href="/static/hgicon.png" type="image/png" />
233 <meta name="robots" content="index, nofollow" />
234 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
235 <script type="text/javascript" src="/static/mercurial.js"></script>
236
237 <title>test: 2ef0ac749a14 /</title>
238 </head>
239 <body>
240
241 <div class="container">
242 <div class="menu">
243 <div class="logo">
244 <a href="https://mercurial-scm.org/">
245 <img src="/static/hglogo.png" alt="mercurial" /></a>
246 </div>
247 <ul>
248 <li><a href="/shortlog/tip">log</a></li>
249 <li><a href="/graph/tip">graph</a></li>
250 <li><a href="/tags">tags</a></li>
251 <li><a href="/bookmarks">bookmarks</a></li>
252 <li><a href="/branches">branches</a></li>
253 </ul>
254 <ul>
255 <li><a href="/rev/tip">changeset</a></li>
256 <li class="active">browse</li>
257 </ul>
258 <ul>
259
260 </ul>
261 <ul>
262 <li><a href="/help">help</a></li>
263 </ul>
264 </div>
265
266 <div class="main">
267 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
268 <h3>
269 directory / @ 0:<a href="/rev/2ef0ac749a14">2ef0ac749a14</a>
270 <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> <span class="tag">@</span> <span class="tag">a b c</span> <span class="tag">d/e/f</span>
271 </h3>
272
273
274 <form class="search" action="/log">
275
276 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
277 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
278 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
279 </form>
280
281 <table class="bigtable">
282 <thead>
283 <tr>
284 <th class="name">name</th>
285 <th class="size">size</th>
286 <th class="permissions">permissions</th>
287 </tr>
288 </thead>
289 <tbody class="stripes2">
290
291
292 <tr class="fileline">
293 <td class="name">
294 <a href="/file/tip/da">
295 <img src="/static/coal-folder.png" alt="dir."/> da/
296 </a>
297 <a href="/file/tip/da/">
298
299 </a>
300 </td>
301 <td class="size"></td>
302 <td class="permissions">drwxr-xr-x</td>
303 </tr>
304
305 <tr class="fileline">
306 <td class="filename">
307 <a href="/file/tip/foo">
308 <img src="/static/coal-file.png" alt="file"/> foo
309 </a>
310 </td>
311 <td class="size">4</td>
312 <td class="permissions">-rw-r--r--</td>
313 </tr>
314 </tbody>
315 </table>
316 </div>
317 </div>
318
319
320 </body>
321 </html>
322
323
324 stop and restart
325
326 $ killdaemons.py
327 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
328 $ cat hg.pid >> $DAEMON_PIDS
329
330 Test the access/error files are opened in append mode
331
332 $ "$PYTHON" -c "print(len(open('access.log', 'rb').readlines()), 'log lines written')"
333 14 log lines written
334
335 static file
336
337 $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
338 200 Script output follows
339 content-length: 9074
340 content-type: text/css
341
342 body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
343 a { color:#0000cc; }
344 a:hover, a:visited, a:active { color:#880000; }
345 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
346 div.page_header a:visited { color:#0000cc; }
347 div.page_header a:hover { color:#880000; }
348 div.page_nav {
349 padding:8px;
350 display: flex;
351 justify-content: space-between;
352 align-items: center;
353 }
354 div.page_nav a:visited { color:#0000cc; }
355 div.extra_nav {
356 padding: 8px;
357 }
358 div.extra_nav a:visited {
359 color: #0000cc;
360 }
361 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
362 div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
363 div.page_footer_text { float:left; color:#555555; font-style:italic; }
364 div.page_body { padding:8px; }
365 div.title, a.title {
366 display:block; padding:6px 8px;
367 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
368 }
369 a.title:hover { background-color: #d9d8d1; }
370 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
371 div.log_body { padding:8px 8px 8px 150px; }
372 .age { white-space:nowrap; }
373 a.title span.age { position:relative; float:left; width:142px; font-style:italic; }
374 div.log_link {
375 padding:0px 8px;
376 font-size:10px; font-family:sans-serif; font-style:normal;
377 position:relative; float:left; width:136px;
378 }
379 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
380 a.list { text-decoration:none; color:#000000; }
381 a.list:hover { text-decoration:underline; color:#880000; }
382 table { padding:8px 4px; }
383 th { padding:2px 5px; font-size:12px; text-align:left; }
384 .parity0 { background-color:#ffffff; }
385 tr.dark, .parity1, pre.sourcelines.stripes > :nth-child(4n+4) { background-color:#f6f6f0; }
386 tr.light:hover, .parity0:hover, tr.dark:hover, .parity1:hover,
387 pre.sourcelines.stripes > :nth-child(4n+2):hover,
388 pre.sourcelines.stripes > :nth-child(4n+4):hover,
389 pre.sourcelines.stripes > :nth-child(4n+1):hover + :nth-child(4n+2),
390 pre.sourcelines.stripes > :nth-child(4n+3):hover + :nth-child(4n+4) { background-color:#edece6; }
391 td { padding:2px 5px; font-size:12px; vertical-align:top; }
392 td.closed { background-color: #99f; }
393 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
394 td.indexlinks { white-space: nowrap; }
395 td.indexlinks a {
396 padding: 2px 5px; line-height: 10px;
397 border: 1px solid;
398 color: #ffffff; background-color: #7777bb;
399 border-color: #aaaadd #333366 #333366 #aaaadd;
400 font-weight: bold; text-align: center; text-decoration: none;
401 font-size: 10px;
402 }
403 td.indexlinks a:hover { background-color: #6666aa; }
404 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
405
406 .search {
407 margin-right: 8px;
408 }
409
410 div#hint {
411 position: absolute;
412 display: none;
413 width: 250px;
414 padding: 5px;
415 background: #ffc;
416 border: 1px solid yellow;
417 border-radius: 5px;
418 z-index: 15;
419 }
420
421 #searchform:hover div#hint { display: block; }
422
423 tr.thisrev a { color:#999999; text-decoration: none; }
424 tr.thisrev pre { color:#009900; }
425 td.annotate {
426 white-space: nowrap;
427 }
428 div.annotate-info {
429 z-index: 5;
430 display: none;
431 position: absolute;
432 background-color: #FFFFFF;
433 border: 1px solid #d9d8d1;
434 text-align: left;
435 color: #000000;
436 padding: 5px;
437 }
438 div.annotate-info a { color: #0000FF; text-decoration: underline; }
439 td.annotate:hover div.annotate-info { display: inline; }
440
441 #diffopts-form {
442 padding-left: 8px;
443 display: none;
444 }
445
446 .linenr { color:#999999; text-decoration:none }
447 div.rss_logo { float: right; white-space: nowrap; }
448 div.rss_logo a {
449 padding:3px 6px; line-height:10px;
450 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
451 color:#ffffff; background-color:#ff6600;
452 font-weight:bold; font-family:sans-serif; font-size:10px;
453 text-align:center; text-decoration:none;
454 }
455 div.rss_logo a:hover { background-color:#ee5500; }
456 pre { margin: 0; }
457 span.logtags span {
458 padding: 0px 4px;
459 font-size: 10px;
460 font-weight: normal;
461 border: 1px solid;
462 background-color: #ffaaff;
463 border-color: #ffccff #ff00ee #ff00ee #ffccff;
464 }
465 span.logtags span.phasetag {
466 background-color: #dfafff;
467 border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
468 }
469 span.logtags span.obsoletetag {
470 background-color: #dddddd;
471 border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
472 }
473 span.logtags span.instabilitytag {
474 background-color: #ffb1c0;
475 border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
476 }
477 span.logtags span.tagtag {
478 background-color: #ffffaa;
479 border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
480 }
481 span.logtags span.branchtag {
482 background-color: #aaffaa;
483 border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
484 }
485 span.logtags span.inbranchtag {
486 background-color: #d5dde6;
487 border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4;
488 }
489 span.logtags span.bookmarktag {
490 background-color: #afdffa;
491 border-color: #ccecff #46ace6 #46ace6 #ccecff;
492 }
493 span.difflineplus { color:#008800; }
494 span.difflineminus { color:#cc0000; }
495 span.difflineat { color:#990099; }
496 div.diffblocks { counter-reset: lineno; }
497 div.diffblock { counter-increment: lineno; }
498 pre.sourcelines { position: relative; counter-reset: lineno; }
499 pre.sourcelines > span {
500 display: inline-block;
501 box-sizing: border-box;
502 width: 100%;
503 padding: 0 0 0 5em;
504 counter-increment: lineno;
505 vertical-align: top;
506 }
507 pre.sourcelines > span:before {
508 -moz-user-select: -moz-none;
509 -khtml-user-select: none;
510 -webkit-user-select: none;
511 -ms-user-select: none;
512 user-select: none;
513 display: inline-block;
514 margin-left: -6em;
515 width: 4em;
516 color: #999;
517 text-align: right;
518 content: counters(lineno,".");
519 float: left;
520 }
521 pre.sourcelines > a {
522 display: inline-block;
523 position: absolute;
524 left: 0px;
525 width: 4em;
526 height: 1em;
527 }
528 tr:target td,
529 pre.sourcelines > span:target,
530 pre.sourcelines.stripes > span:target {
531 background-color: #bfdfff;
532 }
533
534 .description {
535 font-family: monospace;
536 white-space: pre;
537 }
538
539 /* Followlines */
540 tbody.sourcelines > tr.followlines-selected,
541 pre.sourcelines > span.followlines-selected {
542 background-color: #99C7E9 !important;
543 }
544
545 div#followlines {
546 background-color: #FFF;
547 border: 1px solid #d9d8d1;
548 padding: 5px;
549 position: fixed;
550 }
551
552 div.followlines-cancel {
553 text-align: right;
554 }
555
556 div.followlines-cancel > button {
557 line-height: 80%;
558 padding: 0;
559 border: 0;
560 border-radius: 2px;
561 background-color: inherit;
562 font-weight: bold;
563 }
564
565 div.followlines-cancel > button:hover {
566 color: #FFFFFF;
567 background-color: #CF1F1F;
568 }
569
570 div.followlines-link {
571 margin: 2px;
572 margin-top: 4px;
573 font-family: sans-serif;
574 }
575
576 .btn-followlines {
577 position: absolute;
578 display: none;
579 cursor: pointer;
580 box-sizing: content-box;
581 font-size: 11px;
582 width: 13px;
583 height: 13px;
584 border-radius: 3px;
585 margin: 0px;
586 margin-top: -2px;
587 padding: 0px;
588 background-color: #E5FDE5;
589 border: 1px solid #9BC19B;
590 font-family: monospace;
591 text-align: center;
592 line-height: 5px;
593 }
594
595 span.followlines-select .btn-followlines {
596 margin-left: -1.6em;
597 }
598
599 .btn-followlines:hover {
600 transform: scale(1.1, 1.1);
601 }
602
603 .btn-followlines .followlines-plus {
604 color: green;
605 }
606
607 .btn-followlines .followlines-minus {
608 color: red;
609 }
610
611 .btn-followlines-end {
612 background-color: #ffdcdc;
613 }
614
615 .sourcelines tr:hover .btn-followlines,
616 .sourcelines span.followlines-select:hover > .btn-followlines {
617 display: inline;
618 }
619
620 .btn-followlines-hidden,
621 .sourcelines tr:hover .btn-followlines-hidden {
622 display: none;
623 }
624
625 /* Graph */
626 div#wrapper {
627 position: relative;
628 margin: 0;
629 padding: 0;
630 margin-top: 3px;
631 }
632
633 canvas {
634 position: absolute;
635 z-index: 5;
636 top: -0.9em;
637 margin: 0;
638 }
639
640 ul#graphnodes {
641 list-style: none inside none;
642 padding: 0;
643 margin: 0;
644 }
645
646 ul#graphnodes li {
647 position: relative;
648 height: 37px;
649 overflow: visible;
650 padding-top: 2px;
651 }
652
653 ul#graphnodes li .fg {
654 position: absolute;
655 z-index: 10;
656 }
657
658 ul#graphnodes li .info {
659 font-size: 100%;
660 font-style: italic;
661 }
662
663 /* Comparison */
664 .legend {
665 padding: 1.5% 0 1.5% 0;
666 }
667
668 .legendinfo {
669 border: 1px solid #d9d8d1;
670 font-size: 80%;
671 text-align: center;
672 padding: 0.5%;
673 }
674
675 .equal {
676 background-color: #ffffff;
677 }
678
679 .delete {
680 background-color: #faa;
681 color: #333;
682 }
683
684 .insert {
685 background-color: #ffa;
686 }
687
688 .replace {
689 background-color: #e8e8e8;
690 }
691
692 .comparison {
693 overflow-x: auto;
694 }
695
696 .header th {
697 text-align: center;
698 }
699
700 .block {
701 border-top: 1px solid #d9d8d1;
702 }
703
704 .scroll-loading {
705 -webkit-animation: change_color 1s linear 0s infinite alternate;
706 -moz-animation: change_color 1s linear 0s infinite alternate;
707 -o-animation: change_color 1s linear 0s infinite alternate;
708 animation: change_color 1s linear 0s infinite alternate;
709 }
710
711 @-webkit-keyframes change_color {
712 from { background-color: #A0CEFF; } to { }
713 }
714 @-moz-keyframes change_color {
715 from { background-color: #A0CEFF; } to { }
716 }
717 @-o-keyframes change_color {
718 from { background-color: #A0CEFF; } to { }
719 }
720 @keyframes change_color {
721 from { background-color: #A0CEFF; } to { }
722 }
723
724 .scroll-loading-error {
725 background-color: #FFCCCC !important;
726 }
727
728 #doc {
729 margin: 0 8px;
730 }
731 304 Not Modified
732
733
734 phase changes are refreshed (issue4061)
735
736 $ echo bar >> foo
737 $ hg ci -msecret --secret
738 $ get-with-headers.py localhost:$HGPORT 'log?style=raw'
739 200 Script output follows
740
741
742 # HG changelog
743 # Node ID 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
744
745 changeset: 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
746 revision: 0
747 user: test
748 date: Thu, 01 Jan 1970 00:00:00 +0000
749 summary: base
750 branch: default
751 tag: tip
752 bookmark: @
753 bookmark: a b c
754 bookmark: d/e/f
755
756
757 $ hg phase --draft tip
758 $ get-with-headers.py localhost:$HGPORT 'log?style=raw'
759 200 Script output follows
760
761
762 # HG changelog
763 # Node ID a084749e708a9c4c0a5b652a2a446322ce290e04
764
765 changeset: a084749e708a9c4c0a5b652a2a446322ce290e04
766 revision: 1
767 user: test
768 date: Thu, 01 Jan 1970 00:00:00 +0000
769 summary: secret
770 branch: default
771 tag: tip
772
773 changeset: 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
774 revision: 0
775 user: test
776 date: Thu, 01 Jan 1970 00:00:00 +0000
777 summary: base
778 bookmark: @
779 bookmark: a b c
780 bookmark: d/e/f
781
782
783
784 access bookmarks
785
786 $ get-with-headers.py localhost:$HGPORT 'rev/@?style=paper' | grep -E '^200|changeset 0:'
787 200 Script output follows
788 changeset 0:<a href="/rev/2ef0ac749a14?style=paper">2ef0ac749a14</a>
789
790 $ get-with-headers.py localhost:$HGPORT 'rev/%40?style=paper' | grep -E '^200|changeset 0:'
791 200 Script output follows
792 changeset 0:<a href="/rev/2ef0ac749a14?style=paper">2ef0ac749a14</a>
793
794 $ get-with-headers.py localhost:$HGPORT 'rev/a%20b%20c?style=paper' | grep -E '^200|changeset 0:'
795 200 Script output follows
796 changeset 0:<a href="/rev/2ef0ac749a14?style=paper">2ef0ac749a14</a>
797
798 $ get-with-headers.py localhost:$HGPORT 'rev/d%252Fe%252Ff?style=paper' | grep -E '^200|changeset 0:'
799 200 Script output follows
800 changeset 0:<a href="/rev/2ef0ac749a14?style=paper">2ef0ac749a14</a>
801
802 no '[up]' entry in file view when in root directory
803
804 $ get-with-headers.py localhost:$HGPORT 'file/tip?style=paper' | grep -F '[up]'
805 [1]
806 $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=paper' | grep -F '[up]'
807 <a href="/file/tip/?style=paper">[up]</a>
808 $ get-with-headers.py localhost:$HGPORT 'file/tip?style=coal' | grep -F '[up]'
809 [1]
810 $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=coal' | grep -F '[up]'
811 <a href="/file/tip/?style=coal">[up]</a>
812 $ get-with-headers.py localhost:$HGPORT 'file/tip?style=gitweb' | grep -F '[up]'
813 [1]
814 $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=gitweb' | grep -F '[up]'
815 <a href="/file/tip/?style=gitweb">[up]</a>
816 $ get-with-headers.py localhost:$HGPORT 'file/tip?style=monoblue' | grep -F '[up]'
817 [1]
818 $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=monoblue' | grep -F '[up]'
819 <a href="/file/tip/?style=monoblue">[up]</a>
820 $ get-with-headers.py localhost:$HGPORT 'file/tip?style=spartan' | grep -F '[up]'
821 [1]
822 $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=spartan' | grep -F '[up]'
823 <a href="/file/tip/?style=spartan">[up]</a>
824
825 no style can be loaded from directories other than the specified paths
826
827 $ mkdir -p x/templates/fallback
828 $ cat <<EOF > x/templates/fallback/map
829 > default = 'shortlog'
830 > shortlog = 'fall back to default\n'
831 > mimetype = 'text/plain'
832 > EOF
833 $ cat <<EOF > x/map
834 > default = 'shortlog'
835 > shortlog = 'access to outside of templates directory\n'
836 > mimetype = 'text/plain'
837 > EOF
838
839 $ killdaemons.py
840 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log \
841 > --config web.style=fallback --config web.templates=x/templates
842 $ cat hg.pid >> $DAEMON_PIDS
843
844 $ get-with-headers.py localhost:$HGPORT "?style=`pwd`/x"
845 200 Script output follows
846
847 fall back to default
848
849 $ get-with-headers.py localhost:$HGPORT '?style=..'
850 200 Script output follows
851
852 fall back to default
853
854 $ get-with-headers.py localhost:$HGPORT '?style=./..'
855 200 Script output follows
856
857 fall back to default
858
859 $ get-with-headers.py localhost:$HGPORT '?style=.../.../'
860 200 Script output follows
861
862 fall back to default
863
864 $ killdaemons.py
865
866 Test signal-safe-lock in web and non-web processes
867
868 $ cat <<'EOF' > disablesig.py
869 > import signal
870 > from mercurial import error, extensions
871 > def disabledsig(orig, signalnum, handler):
872 > if signalnum == signal.SIGTERM:
873 > raise error.Abort(b'SIGTERM cannot be replaced')
874 > try:
875 > return orig(signalnum, handler)
876 > except ValueError:
877 > raise error.Abort(b'signal.signal() called in thread?')
878 > def uisetup(ui):
879 > extensions.wrapfunction(signal, 'signal', disabledsig)
880 > EOF
881
882 by default, signal interrupt should be disabled while making a lock file
883
884 $ hg debuglock -s --config extensions.disablesig=disablesig.py
885 abort: SIGTERM cannot be replaced
886 [255]
887
888 but in hgweb, it isn't disabled since some WSGI servers complains about
889 unsupported signal.signal() calls (see issue5889)
890
891 $ hg serve --config extensions.disablesig=disablesig.py \
892 > --config web.allow-push='*' --config web.push_ssl=False \
893 > -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
894 $ cat hg.pid >> $DAEMON_PIDS
895
896 $ hg clone -q http://localhost:$HGPORT/ repo
897 $ hg bookmark -R repo foo
898
899 push would fail if signal.signal() were called
900
901 $ hg push -R repo -B foo
902 pushing to http://localhost:$HGPORT/
903 searching for changes
904 no changes found
905 exporting bookmark foo
906 [1]
907
908 $ rm -R repo
909 $ killdaemons.py
910
911 errors
912
913 $ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py
914 $ rm -f errors.log
915
916 Uncaught exceptions result in a logged error and canned HTTP response
917
918 $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
919 $ cat hg.pid >> $DAEMON_PIDS
920
921 $ get-with-headers.py localhost:$HGPORT 'raiseerror' transfer-encoding content-type
922 500 Internal Server Error
923 transfer-encoding: chunked
924
925 Internal Server Error (no-eol)
926 [1]
927
928 $ killdaemons.py
929 $ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py
930 .* Exception happened during processing request '/raiseerror': (re)
931 Traceback (most recent call last):
932 AttributeError: I am an uncaught error!
933
934
935 Uncaught exception after partial content sent
936
937 $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
938 $ cat hg.pid >> $DAEMON_PIDS
939 $ get-with-headers.py localhost:$HGPORT 'raiseerror?partialresponse=1' transfer-encoding content-type
940 200 Script output follows
941 transfer-encoding: chunked
942 content-type: text/plain
943
944 partial content
945 Internal Server Error (no-eol)
946
947 $ killdaemons.py
948
949 HTTP 304 works with hgwebdir (issue5844)
950
951 $ cat > hgweb.conf << EOF
952 > [paths]
953 > /repo = $TESTTMP/test
954 > EOF
955
956 $ hg serve --web-conf hgweb.conf -p $HGPORT -d --pid-file hg.pid -E error.log
957 $ cat hg.pid >> $DAEMON_PIDS
958
959 $ get-with-headers.py --twice --headeronly localhost:$HGPORT 'repo/static/style.css' - date etag server
960 200 Script output follows
961 content-length: 2677
962 content-type: text/css
963 304 Not Modified
964
965 $ killdaemons.py
966
967 $ cd ..