author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
Wed, 17 Sep 2008 11:34:37 +0200 | |
changeset 7040 | f29b674cc221 |
parent 6987 | d09e813b21e3 |
parent 7038 | d1c82127573e |
child 7054 | e837f2294643 |
permissions | -rw-r--r-- |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
1 |
adding get-with-headers.py |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
2 |
% hg serve |
6987
d09e813b21e3
highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents:
6907
diff
changeset
|
3 |
% hgweb filerevision, html |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
200 Script output follows |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
5 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
6 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
7 |
<html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
8 |
<head> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
9 |
<link rel="icon" href="/static/hgicon.png" type="image/png"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
10 |
<meta name="robots" content="index, nofollow" /> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
11 |
<link rel="stylesheet" href="/static/style.css" type="text/css" /> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
12 |
|
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
13 |
<link rel="stylesheet" href="/highlightcss" type="text/css" /> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
14 |
<title>test:get-with-headers.py</title> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
15 |
</head> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
16 |
<body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
17 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
18 |
<div class="buttons"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
19 |
<a href="/log/0">changelog</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
20 |
<a href="/shortlog/0">shortlog</a> |
6695
001647a33ff8
tests: fix test breakage from graph template changes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6657
diff
changeset
|
21 |
<a href="/graph">graph</a> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
<a href="/tags">tags</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
23 |
<a href="/rev/79ee608ca36d">changeset</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
24 |
<a href="/file/79ee608ca36d/">files</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
25 |
<a href="/log/79ee608ca36d/get-with-headers.py">revisions</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
26 |
<a href="/annotate/79ee608ca36d/get-with-headers.py">annotate</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
27 |
<a href="/raw-file/79ee608ca36d/get-with-headers.py">raw</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
28 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
29 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
30 |
<h2>get-with-headers.py</h2> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
31 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
32 |
<table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
33 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
34 |
<td class="metatag">changeset 0:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
35 |
<td><a href="/rev/79ee608ca36d">79ee608ca36d</a></td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
36 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
37 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
38 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
39 |
<td class="metatag">author:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
40 |
<td>test</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
41 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
42 |
<td class="metatag">date:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
43 |
<td>Thu Jan 01 00:00:00 1970 +0000 (long ago)</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
44 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 |
<td class="metatag">permissions:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
46 |
<td>-rwxr-xr-x</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
47 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
48 |
<td class="metatag">description:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
49 |
<td>a</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
50 |
</tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
51 |
</table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
52 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
53 |
<pre> |
7038
d1c82127573e
tests: fix test-highlight for compatiblity with newer Pygments
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6355
diff
changeset
|
54 |
<div class="parity0"><a class="lineno" href="#l1" id="l1"> 1</a><span class="c">#!/usr/bin/env python</span></div><div class="parity1"><a class="lineno" href="#l2" id="l2"> 2</a></div><div class="parity0"><a class="lineno" href="#l3" id="l3"> 3</a><span class="n">__doc__</span> <span class="o">=</span> <span class="s">"""This does HTTP get requests given a host:port and path and returns</span></div><div class="parity1"><a class="lineno" href="#l4" id="l4"> 4</a><span class="s">a subset of the headers plus the body of the result."""</span></div><div class="parity0"><a class="lineno" href="#l5" id="l5"> 5</a></div><div class="parity1"><a class="lineno" href="#l6" id="l6"> 6</a><span class="kn">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></div><div class="parity0"><a class="lineno" href="#l7" id="l7"> 7</a><span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></div><div class="parity1"><a class="lineno" href="#l8" id="l8"> 8</a><span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></div><div class="parity0"><a class="lineno" href="#l9" id="l9"> 9</a><span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">"GET"</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></div><div class="parity1"><a class="lineno" href="#l10" id="l10"> 10</a><span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></div><div class="parity0"><a class="lineno" href="#l11" id="l11"> 11</a><span class="kn">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></div><div class="parity1"><a class="lineno" href="#l12" id="l12"> 12</a><span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></div><div class="parity0"><a class="lineno" href="#l13" id="l13"> 13</a> <span class="kn">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></div><div class="parity1"><a class="lineno" href="#l14" id="l14"> 14</a> <span class="kn">print</span> <span class="s">"</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></div><div class="parity0"><a class="lineno" href="#l15" id="l15"> 15</a><span class="kn">print</span></div><div class="parity1"><a class="lineno" href="#l16" id="l16"> 16</a><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></div><div class="parity0"><a class="lineno" href="#l17" id="l17"> 17</a></div><div class="parity1"><a class="lineno" href="#l18" id="l18"> 18</a><span class="kn">if</span> <span class="mf">200</span> <span class="o"><=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o"><=</span> <span class="mf">299</span><span class="p">:</span></div><div class="parity0"><a class="lineno" href="#l19" id="l19"> 19</a> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></div><div class="parity1"><a class="lineno" href="#l20" id="l20"> 20</a><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></div> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
55 |
</pre> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
56 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
57 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
58 |
<div class="logo"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
59 |
<a href="http://www.selenic.com/mercurial/"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
60 |
<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
61 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
62 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
63 |
</body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
64 |
</html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
65 |
|
6987
d09e813b21e3
highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents:
6907
diff
changeset
|
66 |
% hgweb fileannotate, html |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
67 |
200 Script output follows |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
68 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
69 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
70 |
<html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
71 |
<head> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
72 |
<link rel="icon" href="/static/hgicon.png" type="image/png"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
73 |
<meta name="robots" content="index, nofollow" /> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
74 |
<link rel="stylesheet" href="/static/style.css" type="text/css" /> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
75 |
|
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
76 |
<link rel="stylesheet" href="/highlightcss" type="text/css" /> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
77 |
<title>test: get-with-headers.py annotate</title> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
78 |
</head> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
79 |
<body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
80 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
81 |
<div class="buttons"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
82 |
<a href="/log/0">changelog</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
83 |
<a href="/shortlog/0">shortlog</a> |
6695
001647a33ff8
tests: fix test breakage from graph template changes
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6657
diff
changeset
|
84 |
<a href="/graph">graph</a> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
85 |
<a href="/tags">tags</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
86 |
<a href="/rev/79ee608ca36d">changeset</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
87 |
<a href="/file/79ee608ca36d/">files</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
88 |
<a href="/file/79ee608ca36d/get-with-headers.py">file</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
89 |
<a href="/log/79ee608ca36d/get-with-headers.py">revisions</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
90 |
<a href="/raw-annotate/79ee608ca36d/get-with-headers.py">raw</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
91 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
92 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
93 |
<h2>Annotate get-with-headers.py</h2> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
94 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
95 |
<table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
96 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
97 |
<td class="metatag">changeset 0:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
98 |
<td><a href="/rev/79ee608ca36d">79ee608ca36d</a></td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
99 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
100 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
101 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
102 |
<td class="metatag">author:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
103 |
<td>test</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
104 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
105 |
<td class="metatag">date:</td> |
6907 | 106 |
<td>Thu Jan 01 00:00:00 1970 +0000 (long ago)</td> |
107 |
</tr> |
|
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
108 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
109 |
<td class="metatag">permissions:</td> |
6907 | 110 |
<td>-rwxr-xr-x</td> |
111 |
</tr> |
|
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
112 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
113 |
<td class="metatag">description:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
114 |
<td>a</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
115 |
</tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
116 |
</table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
117 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
118 |
<br/> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
119 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
120 |
<table cellspacing="0" cellpadding="0"> |
7040 | 121 |
<tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l1" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l1" id="l1"> 1</a></td><td><pre><span class="c">#!/usr/bin/env python</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l2" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l2" id="l2"> 2</a></td><td><pre></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l3" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l3" id="l3"> 3</a></td><td><pre><span class="n">__doc__</span> <span class="o">=</span> <span class="s">"""This does HTTP get requests given a host:port and path and returns</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l4" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l4" id="l4"> 4</a></td><td><pre><span class="s">a subset of the headers plus the body of the result."""</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l5" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l5" id="l5"> 5</a></td><td><pre></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l6" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l6" id="l6"> 6</a></td><td><pre><span class="kn">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l7" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l7" id="l7"> 7</a></td><td><pre><span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l8" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l8" id="l8"> 8</a></td><td><pre><span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l9" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l9" id="l9"> 9</a></td><td><pre><span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">"GET"</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l10" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l10" id="l10"> 10</a></td><td><pre><span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l11" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l11" id="l11"> 11</a></td><td><pre><span class="kn">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l12" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l12" id="l12"> 12</a></td><td><pre><span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l13" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l13" id="l13"> 13</a></td><td><pre> <span class="kn">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l14" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l14" id="l14"> 14</a></td><td><pre> <span class="kn">print</span> <span class="s">"</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l15" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l15" id="l15"> 15</a></td><td><pre><span class="kn">print</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l16" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l16" id="l16"> 16</a></td><td><pre><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l17" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l17" id="l17"> 17</a></td><td><pre></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l18" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l18" id="l18"> 18</a></td><td><pre><span class="kn">if</span> <span class="mf">200</span> <span class="o"><=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o"><=</span> <span class="mf">299</span><span class="p">:</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l19" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l19" id="l19"> 19</a></td><td><pre> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l20" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l20" id="l20"> 20</a></td><td><pre><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></pre></td></tr> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
122 |
</table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
123 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
124 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
125 |
<div class="logo"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
126 |
<a href="http://www.selenic.com/mercurial/"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
127 |
<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
128 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
129 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
130 |
</body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
131 |
</html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
132 |
|
6987
d09e813b21e3
highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents:
6907
diff
changeset
|
133 |
% hgweb fileannotate, raw |
d09e813b21e3
highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents:
6907
diff
changeset
|
134 |
|
d09e813b21e3
highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents:
6907
diff
changeset
|
135 |
% hgweb filerevision, raw |
d09e813b21e3
highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents:
6907
diff
changeset
|
136 |
|
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
137 |
% hgweb highlightcss friendly |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
138 |
200 Script output follows |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
139 |
|
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
140 |
/* pygments_style = friendly */ |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
141 |
|
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
142 |
% errors encountered |
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
143 |
% hg serve again |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
144 |
% hgweb highlightcss fruity |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
145 |
200 Script output follows |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
146 |
|
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
147 |
/* pygments_style = fruity */ |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
148 |
|
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
149 |
% errors encountered |