author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
Sat, 07 Jun 2008 17:52:00 +0200 | |
changeset 6657 | a51093361e1c |
parent 6568 | 0c4c804c8261 |
child 6695 | 001647a33ff8 |
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 |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
3 |
% hgweb filerevision |
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> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
21 |
<a href="/tags">tags</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
<a href="/rev/79ee608ca36d">changeset</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
23 |
<a href="/file/79ee608ca36d/">files</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
24 |
<a href="/log/79ee608ca36d/get-with-headers.py">revisions</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
25 |
<a href="/annotate/79ee608ca36d/get-with-headers.py">annotate</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
26 |
<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
|
27 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
28 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
29 |
<h2>get-with-headers.py</h2> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
30 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
31 |
<table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
32 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
33 |
<td class="metatag">changeset 0:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
34 |
<td><a href="/rev/79ee608ca36d">79ee608ca36d</a></td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
35 |
|
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 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
38 |
<td class="metatag">author:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
39 |
<td>test</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
40 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
41 |
<td class="metatag">date:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
42 |
<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
|
43 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
44 |
<td class="metatag">permissions:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 |
<td>-rwxr-xr-x</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
46 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
47 |
<td class="metatag">description:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
48 |
<td>a</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
49 |
</tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
50 |
</table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
51 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
52 |
<pre> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
53 |
<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="k">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="k">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="k">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="k">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="k">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="k">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="k">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="k">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> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
54 |
</pre> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
55 |
|
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 |
<div class="logo"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
58 |
<a href="http://www.selenic.com/mercurial/"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
59 |
<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
|
60 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
61 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
62 |
</body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
63 |
</html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
64 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
65 |
% hgweb fileannotate |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
66 |
200 Script output follows |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
67 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
68 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
69 |
<html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
70 |
<head> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
71 |
<link rel="icon" href="/static/hgicon.png" type="image/png"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
72 |
<meta name="robots" content="index, nofollow" /> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
73 |
<link rel="stylesheet" href="/static/style.css" type="text/css" /> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
74 |
|
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
75 |
<link rel="stylesheet" href="/highlightcss" type="text/css" /> |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
76 |
<title>test: get-with-headers.py annotate</title> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
77 |
</head> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
78 |
<body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
79 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
80 |
<div class="buttons"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
81 |
<a href="/log/0">changelog</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
82 |
<a href="/shortlog/0">shortlog</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
83 |
<a href="/tags">tags</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
84 |
<a href="/rev/79ee608ca36d">changeset</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
85 |
<a href="/file/79ee608ca36d/">files</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
86 |
<a href="/file/79ee608ca36d/get-with-headers.py">file</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
87 |
<a href="/log/79ee608ca36d/get-with-headers.py">revisions</a> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
88 |
<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
|
89 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
90 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
91 |
<h2>Annotate get-with-headers.py</h2> |
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 |
<table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
94 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
95 |
<td class="metatag">changeset 0:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
96 |
<td><a href="/rev/79ee608ca36d">79ee608ca36d</a></td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
97 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
98 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
99 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
100 |
<td class="metatag">author:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
101 |
<td>test</td></tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
102 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
103 |
<td class="metatag">date:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
104 |
<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
|
105 |
<tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
106 |
<td class="metatag">permissions:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
107 |
<td>-rwxr-xr-x</td></tr> |
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">description:</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
110 |
<td>a</td> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
111 |
</tr> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
112 |
</table> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
113 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
114 |
<br/> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
115 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
116 |
<table cellspacing="0" cellpadding="0"> |
6657
a51093361e1c
hgweb: show cset node and description when hovering over annotate prefix
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6568
diff
changeset
|
117 |
<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="k">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="k">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="k">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="k">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="k">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="k">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="k">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="k">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
|
118 |
</table> |
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 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
121 |
<div class="logo"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
122 |
<a href="http://www.selenic.com/mercurial/"> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
123 |
<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
|
124 |
</div> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
125 |
|
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
126 |
</body> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
127 |
</html> |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
128 |
|
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
129 |
% hgweb highlightcss friendly |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
130 |
200 Script output follows |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
131 |
|
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
132 |
/* pygments_style = friendly */ |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
133 |
|
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
134 |
% errors encountered |
6485
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
135 |
% hg serve again |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
136 |
% hgweb highlightcss fruity |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
137 |
200 Script output follows |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
138 |
|
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
139 |
/* pygments_style = fruity */ |
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
140 |
|
938319418d8c
highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents:
6355
diff
changeset
|
141 |
% errors encountered |