##// END OF EJS Templates
hgweb: highlight line which is linked to at annotate view
Alexander Plavin -
r19463:f3393d45 default
parent child Browse files
Show More
@@ -1,245 +1,245 b''
1 1 default = 'shortlog'
2 2
3 3 mimetype = 'text/html; charset={encoding}'
4 4 header = header.tmpl
5 5 footer = footer.tmpl
6 6 search = search.tmpl
7 7
8 8 changelog = shortlog.tmpl
9 9 shortlog = shortlog.tmpl
10 10 shortlogentry = shortlogentry.tmpl
11 11 graph = graph.tmpl
12 12 help = help.tmpl
13 13 helptopics = helptopics.tmpl
14 14
15 15 helpentry = '
16 16 <tr><td>
17 17 <a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">
18 18 {topic|escape}
19 19 </a>
20 20 </td><td>
21 21 {summary|escape}
22 22 </td></tr>'
23 23
24 24 naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
25 25 navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
26 26 navgraphentry = '<a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
27 27 filenaventry = '<a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
28 28 filedifflink = '<a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
29 29 filenodelink = '<a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
30 30 filenolink = '{file|escape} '
31 31 fileellipses = '...'
32 32 diffstatlink = diffstat.tmpl
33 33 diffstatnolink = diffstat.tmpl
34 34 changelogentry = shortlogentry.tmpl
35 35 searchentry = shortlogentry.tmpl
36 36 changeset = changeset.tmpl
37 37 manifest = manifest.tmpl
38 38
39 39 nav = '{before%naventry} {after%naventry}'
40 40 navshort = '{before%navshortentry}{after%navshortentry}'
41 41 navgraph = '{before%navgraphentry}{after%navgraphentry}'
42 42 filenav = '{before%filenaventry}{after%filenaventry}'
43 43
44 44 direntry = '
45 45 <tr class="fileline">
46 46 <td class="name">
47 47 <a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">
48 48 <img src="{staticurl|urlescape}coal-folder.png" alt="dir."/> {basename|escape}/
49 49 </a>
50 50 <a href="{url|urlescape}file/{node|short}{path|urlescape}/{emptydirs|urlescape}{sessionvars%urlparameter}">
51 51 {emptydirs|escape}
52 52 </a>
53 53 </td>
54 54 <td class="size"></td>
55 55 <td class="permissions">drwxr-xr-x</td>
56 56 </tr>'
57 57
58 58 fileentry = '
59 59 <tr class="fileline">
60 60 <td class="filename">
61 61 <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">
62 62 <img src="{staticurl|urlescape}coal-file.png" alt="file"/> {basename|escape}
63 63 </a>
64 64 </td>
65 65 <td class="size">{size}</td>
66 66 <td class="permissions">{permissions|permissions}</td>
67 67 </tr>'
68 68
69 69 filerevision = filerevision.tmpl
70 70 fileannotate = fileannotate.tmpl
71 71 filediff = filediff.tmpl
72 72 filecomparison = filecomparison.tmpl
73 73 filelog = filelog.tmpl
74 74 fileline = '
75 75 <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
76 76 filelogentry = filelogentry.tmpl
77 77
78 78 annotateline = '
79 <tr>
79 <tr id="{lineid}">
80 80 <td class="annotate">
81 81 <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"
82 82 title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
83 83 </td>
84 <td class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td>
84 <td class="source"><a href="#{lineid}">{linenumber}</a> {line|escape}</td>
85 85 </tr>'
86 86
87 87 diffblock = '<div class="bottomline inc-lineno"><pre class="sourcelines wrap">{lines}</pre></div>'
88 88 difflineplus = '
89 89 <span id="{lineid}" class="plusline">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
90 90 difflineminus = '
91 91 <span id="{lineid}" class="minusline">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
92 92 difflineat = '
93 93 <span id="{lineid}" class="atline">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
94 94 diffline = '
95 95 <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
96 96
97 97 comparisonblock ='
98 98 <tbody class="block">
99 99 {lines}
100 100 </tbody>'
101 101 comparisonline = '
102 102 <tr id="{lineid}">
103 103 <td class="source {type}"><a href="#{lineid}">{leftlinenumber}</a> {leftline|escape}</td>
104 104 <td class="source {type}"><a href="#{lineid}">{rightlinenumber}</a> {rightline|escape}</td>
105 105 </tr>'
106 106
107 107 changelogparent = '
108 108 <tr>
109 109 <th class="parent">parent {rev}:</th>
110 110 <td class="parent"><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td>
111 111 </tr>'
112 112
113 113 changesetparent = '<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a> '
114 114
115 115 difffrom = '<a href="{url|urlescape}rev/{node|short}:{originalnode|short}{sessionvars%urlparameter}">{node|short}</a> '
116 116
117 117 filerevparent = '<a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{rename%filerename}{node|short}</a> '
118 118 filerevchild = '<a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> '
119 119
120 120 filerename = '{file|escape}@'
121 121 filelogrename = '
122 122 <span class="base">
123 123 base
124 124 <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">
125 125 {file|escape}@{node|short}
126 126 </a>
127 127 </span>'
128 128 fileannotateparent = '
129 129 <tr>
130 130 <td class="metatag">parent:</td>
131 131 <td>
132 132 <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">
133 133 {rename%filerename}{node|short}
134 134 </a>
135 135 </td>
136 136 </tr>'
137 137 changesetchild = ' <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>'
138 138 changelogchild = '
139 139 <tr>
140 140 <th class="child">child</th>
141 141 <td class="child">
142 142 <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
143 143 {node|short}
144 144 </a>
145 145 </td>
146 146 </tr>'
147 147 fileannotatechild = '
148 148 <tr>
149 149 <td class="metatag">child:</td>
150 150 <td>
151 151 <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">
152 152 {node|short}
153 153 </a>
154 154 </td>
155 155 </tr>'
156 156 tags = tags.tmpl
157 157 tagentry = '
158 158 <tr class="tagEntry">
159 159 <td>
160 160 <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
161 161 {tag|escape}
162 162 </a>
163 163 </td>
164 164 <td class="node">
165 165 {node|short}
166 166 </td>
167 167 </tr>'
168 168 bookmarks = bookmarks.tmpl
169 169 bookmarkentry = '
170 170 <tr class="tagEntry">
171 171 <td>
172 172 <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
173 173 {bookmark|escape}
174 174 </a>
175 175 </td>
176 176 <td class="node">
177 177 {node|short}
178 178 </td>
179 179 </tr>'
180 180 branches = branches.tmpl
181 181 branchentry = '
182 182 <tr class="tagEntry">
183 183 <td>
184 184 <a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}" class="{status}">
185 185 {branch|escape}
186 186 </a>
187 187 </td>
188 188 <td class="node">
189 189 {node|short}
190 190 </td>
191 191 </tr>'
192 192 changelogtag = '<span class="tag">{name|escape}</span> '
193 193 changesettag = '<span class="tag">{tag|escape}</span> '
194 194 changesetbookmark = '<span class="tag">{bookmark|escape}</span> '
195 195 changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
196 196 changelogbranchname = '<span class="branchname">{name|escape}</span> '
197 197
198 198 filediffparent = '
199 199 <tr>
200 200 <th class="parent">parent {rev}:</th>
201 201 <td class="parent"><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td>
202 202 </tr>'
203 203 filelogparent = '
204 204 <tr>
205 205 <th>parent {rev}:</th>
206 206 <td><a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td>
207 207 </tr>'
208 208 filediffchild = '
209 209 <tr>
210 210 <th class="child">child {rev}:</th>
211 211 <td class="child"><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
212 212 </td>
213 213 </tr>'
214 214 filelogchild = '
215 215 <tr>
216 216 <th>child {rev}:</th>
217 217 <td><a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td>
218 218 </tr>'
219 219
220 220 indexentry = '
221 221 <tr>
222 222 <td><a href="{url|urlescape}{sessionvars%urlparameter}">{name|escape}</a></td>
223 223 <td>{description}</td>
224 224 <td>{contact|obfuscate}</td>
225 225 <td class="age">{lastchange|rfc822date}</td>
226 226 <td class="indexlinks">{archives%indexarchiveentry}</td>
227 227 <td>
228 228 {if(isdirectory, '',
229 229 '<a href="{url|urlescape}atom-log" title="subscribe to repository atom feed">
230 230 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="subscribe to repository atom feed">
231 231 </a>'
232 232 )}
233 233 </td>
234 234 </tr>\n'
235 235 indexarchiveentry = '<a href="{url|urlescape}archive/{node|short}{extension|urlescape}">&nbsp;&darr;{type|escape}</a>'
236 236 index = index.tmpl
237 237 archiveentry = '
238 238 <li>
239 239 <a href="{url|urlescape}archive/{node|short}{extension|urlescape}{ifeq(path,'/','',path|urlescape)}">{type|escape}</a>
240 240 </li>'
241 241 notfound = notfound.tmpl
242 242 error = error.tmpl
243 243 urlparameter = '{separator}{name}={value|urlescape}'
244 244 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
245 245 breadcrumb = '&gt; <a href="{url|urlescape}">{name|escape}</a> '
@@ -1,609 +1,609 b''
1 1
2 2 $ "$TESTDIR/hghave" pygments serve || exit 80
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [extensions]
5 5 > highlight =
6 6 > [web]
7 7 > pygments_style = friendly
8 8 > EOF
9 9 $ hg init test
10 10 $ cd test
11 11
12 12 create random Python file to exercise Pygments
13 13
14 14 $ cat <<EOF > primes.py
15 15 > #!/usr/bin/env python
16 16 >
17 17 > """Fun with generators. Corresponding Haskell implementation:
18 18 >
19 19 > primes = 2 : sieve [3, 5..]
20 20 > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
21 21 > """
22 22 >
23 23 > from itertools import dropwhile, ifilter, islice, count, chain
24 24 >
25 25 > def primes():
26 26 > """Generate all primes."""
27 27 > def sieve(ns):
28 28 > p = ns.next()
29 29 > # It is important to yield *here* in order to stop the
30 30 > # infinite recursion.
31 31 > yield p
32 32 > ns = ifilter(lambda n: n % p != 0, ns)
33 33 > for n in sieve(ns):
34 34 > yield n
35 35 >
36 36 > odds = ifilter(lambda i: i % 2 == 1, count())
37 37 > return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
38 38 >
39 39 > if __name__ == "__main__":
40 40 > import sys
41 41 > try:
42 42 > n = int(sys.argv[1])
43 43 > except (ValueError, IndexError):
44 44 > n = 10
45 45 > p = primes()
46 46 > print "The first %d primes: %s" % (n, list(islice(p, n)))
47 47 > EOF
48 48 $ hg ci -Ama
49 49 adding primes.py
50 50
51 51 hg serve
52 52
53 53 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
54 54 $ cat hg.pid >> $DAEMON_PIDS
55 55
56 56 hgweb filerevision, html
57 57
58 58 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT 'file/tip/primes.py') \
59 59 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
60 60 200 Script output follows
61 61
62 62 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
63 63 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
64 64 <head>
65 65 <link rel="icon" href="/static/hgicon.png" type="image/png" />
66 66 <meta name="robots" content="index, nofollow" />
67 67 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
68 68 <script type="text/javascript" src="/static/mercurial.js"></script>
69 69
70 70 <link rel="stylesheet" href="/highlightcss" type="text/css" />
71 71 <title>test: 853dcd4de2a6 primes.py</title>
72 72 </head>
73 73 <body>
74 74
75 75 <div class="container">
76 76 <div class="menu">
77 77 <div class="logo">
78 78 <a href="http://mercurial.selenic.com/">
79 79 <img src="/static/hglogo.png" alt="mercurial" /></a>
80 80 </div>
81 81 <ul>
82 82 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
83 83 <li><a href="/graph/853dcd4de2a6">graph</a></li>
84 84 <li><a href="/tags">tags</a></li>
85 85 <li><a href="/branches">branches</a></li>
86 86 </ul>
87 87 <ul>
88 88 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
89 89 <li><a href="/file/853dcd4de2a6/">browse</a></li>
90 90 </ul>
91 91 <ul>
92 92 <li class="active">file</li>
93 93 <li><a href="/file/tip/primes.py">latest</a></li>
94 94 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
95 95 <li><a href="/comparison/853dcd4de2a6/primes.py">comparison</a></li>
96 96 <li><a href="/annotate/853dcd4de2a6/primes.py">annotate</a></li>
97 97 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
98 98 <li><a href="/raw-file/853dcd4de2a6/primes.py">raw</a></li>
99 99 </ul>
100 100 <ul>
101 101 <li><a href="/help">help</a></li>
102 102 </ul>
103 103 </div>
104 104
105 105 <div class="main">
106 106 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
107 107 <h3>view primes.py @ 0:853dcd4de2a6</h3>
108 108
109 109 <form class="search" action="/log">
110 110
111 111 <p><input name="rev" id="search1" type="text" size="30" /></p>
112 112 <div id="hint">find changesets by author, revision,
113 113 files, or words in the commit message</div>
114 114 </form>
115 115
116 116 <div class="description">a</div>
117 117
118 118 <table id="changesetEntry">
119 119 <tr>
120 120 <th class="author">author</th>
121 121 <td class="author">&#116;&#101;&#115;&#116;</td>
122 122 </tr>
123 123 <tr>
124 124 <th class="date">date</th>
125 125 <td class="date age">Thu, 01 Jan 1970 00:00:00 +0000</td>
126 126 </tr>
127 127 <tr>
128 128 <th class="author">parents</th>
129 129 <td class="author"></td>
130 130 </tr>
131 131 <tr>
132 132 <th class="author">children</th>
133 133 <td class="author"></td>
134 134 </tr>
135 135
136 136 </table>
137 137
138 138 <div class="overflow">
139 139 <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
140 140 <div class="sourcefirst"> line source</div>
141 141 <pre class="sourcelines stripes4 wrap">
142 142 <span id="l1"><span class="c">#!/usr/bin/env python</span></span><a href="#l1"></a>
143 143 <span id="l2"></span><a href="#l2"></a>
144 144 <span id="l3"><span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></span><a href="#l3"></a>
145 145 <span id="l4"></span><a href="#l4"></a>
146 146 <span id="l5"><span class="sd">primes = 2 : sieve [3, 5..]</span></span><a href="#l5"></a>
147 147 <span id="l6"><span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></span><a href="#l6"></a>
148 148 <span id="l7"><span class="sd">&quot;&quot;&quot;</span></span><a href="#l7"></a>
149 149 <span id="l8"></span><a href="#l8"></a>
150 150 <span id="l9"><span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></span><a href="#l9"></a>
151 151 <span id="l10"></span><a href="#l10"></a>
152 152 <span id="l11"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l11"></a>
153 153 <span id="l12"> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></span><a href="#l12"></a>
154 154 <span id="l13"> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l13"></a>
155 155 <span id="l14"> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></span><a href="#l14"></a>
156 156 <span id="l15"> <span class="c"># It is important to yield *here* in order to stop the</span></span><a href="#l15"></a>
157 157 <span id="l16"> <span class="c"># infinite recursion.</span></span><a href="#l16"></a>
158 158 <span id="l17"> <span class="kn">yield</span> <span class="n">p</span></span><a href="#l17"></a>
159 159 <span id="l18"> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></span><a href="#l18"></a>
160 160 <span id="l19"> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l19"></a>
161 161 <span id="l20"> <span class="kn">yield</span> <span class="n">n</span></span><a href="#l20"></a>
162 162 <span id="l21"></span><a href="#l21"></a>
163 163 <span id="l22"> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></span><a href="#l22"></a>
164 164 <span id="l23"> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></span><a href="#l23"></a>
165 165 <span id="l24"></span><a href="#l24"></a>
166 166 <span id="l25"><span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></span><a href="#l25"></a>
167 167 <span id="l26"> <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l26"></a>
168 168 <span id="l27"> <span class="kn">try</span><span class="p">:</span></span><a href="#l27"></a>
169 169 <span id="l28"> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</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="mi">1</span><span class="p">])</span></span><a href="#l28"></a>
170 170 <span id="l29"> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></span><a href="#l29"></a>
171 171 <span id="l30"> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></span><a href="#l30"></a>
172 172 <span id="l31"> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></span><a href="#l31"></a>
173 173 <span id="l32"> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></span><a href="#l32"></a></pre>
174 174 <div class="sourcelast"></div>
175 175 </div>
176 176 </div>
177 177 </div>
178 178
179 179 <script type="text/javascript">process_dates()</script>
180 180
181 181
182 182 </body>
183 183 </html>
184 184
185 185
186 186 hgweb fileannotate, html
187 187
188 188 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT 'annotate/tip/primes.py') \
189 189 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mi\"/class=\"mf\"/g"
190 190 200 Script output follows
191 191
192 192 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
193 193 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
194 194 <head>
195 195 <link rel="icon" href="/static/hgicon.png" type="image/png" />
196 196 <meta name="robots" content="index, nofollow" />
197 197 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
198 198 <script type="text/javascript" src="/static/mercurial.js"></script>
199 199
200 200 <link rel="stylesheet" href="/highlightcss" type="text/css" />
201 201 <title>test: primes.py annotate</title>
202 202 </head>
203 203 <body>
204 204
205 205 <div class="container">
206 206 <div class="menu">
207 207 <div class="logo">
208 208 <a href="http://mercurial.selenic.com/">
209 209 <img src="/static/hglogo.png" alt="mercurial" /></a>
210 210 </div>
211 211 <ul>
212 212 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
213 213 <li><a href="/graph/853dcd4de2a6">graph</a></li>
214 214 <li><a href="/tags">tags</a></li>
215 215 <li><a href="/bookmarks">bookmarks</a></li>
216 216 <li><a href="/branches">branches</a></li>
217 217 </ul>
218 218
219 219 <ul>
220 220 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
221 221 <li><a href="/file/853dcd4de2a6/">browse</a></li>
222 222 </ul>
223 223 <ul>
224 224 <li><a href="/file/853dcd4de2a6/primes.py">file</a></li>
225 225 <li><a href="/file/tip/primes.py">latest</a></li>
226 226 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
227 227 <li><a href="/comparison/853dcd4de2a6/primes.py">comparison</a></li>
228 228 <li class="active">annotate</li>
229 229 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
230 230 <li><a href="/raw-annotate/853dcd4de2a6/primes.py">raw</a></li>
231 231 </ul>
232 232 <ul>
233 233 <li><a href="/help">help</a></li>
234 234 </ul>
235 235 </div>
236 236
237 237 <div class="main">
238 238 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
239 239 <h3>annotate primes.py @ 0:853dcd4de2a6</h3>
240 240
241 241 <form class="search" action="/log">
242 242
243 243 <p><input name="rev" id="search1" type="text" size="30" /></p>
244 244 <div id="hint">find changesets by author, revision,
245 245 files, or words in the commit message</div>
246 246 </form>
247 247
248 248 <div class="description">a</div>
249 249
250 250 <table id="changesetEntry">
251 251 <tr>
252 252 <th class="author">author</th>
253 253 <td class="author">&#116;&#101;&#115;&#116;</td>
254 254 </tr>
255 255 <tr>
256 256 <th class="date">date</th>
257 257 <td class="date age">Thu, 01 Jan 1970 00:00:00 +0000</td>
258 258 </tr>
259 259 <tr>
260 260 <th class="author">parents</th>
261 261 <td class="author"></td>
262 262 </tr>
263 263 <tr>
264 264 <th class="author">children</th>
265 265 <td class="author"></td>
266 266 </tr>
267 267
268 268 </table>
269 269
270 270 <div class="overflow">
271 271 <table class="bigtable">
272 272 <tr>
273 273 <th class="annotate">rev</th>
274 274 <th class="line">&nbsp;&nbsp;line source</th>
275 275 </tr>
276 276 <tbody class="stripes2">
277 277
278 <tr>
278 <tr id="l1">
279 279 <td class="annotate">
280 280 <a href="/annotate/853dcd4de2a6/primes.py#l1"
281 281 title="853dcd4de2a6: a">test@0</a>
282 282 </td>
283 <td class="source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
283 <td class="source"><a href="#l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
284 284 </tr>
285 <tr>
285 <tr id="l2">
286 286 <td class="annotate">
287 287 <a href="/annotate/853dcd4de2a6/primes.py#l2"
288 288 title="853dcd4de2a6: a">test@0</a>
289 289 </td>
290 <td class="source"><a href="#l2" id="l2"> 2</a> </td>
290 <td class="source"><a href="#l2"> 2</a> </td>
291 291 </tr>
292 <tr>
292 <tr id="l3">
293 293 <td class="annotate">
294 294 <a href="/annotate/853dcd4de2a6/primes.py#l3"
295 295 title="853dcd4de2a6: a">test@0</a>
296 296 </td>
297 <td class="source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
297 <td class="source"><a href="#l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
298 298 </tr>
299 <tr>
299 <tr id="l4">
300 300 <td class="annotate">
301 301 <a href="/annotate/853dcd4de2a6/primes.py#l4"
302 302 title="853dcd4de2a6: a">test@0</a>
303 303 </td>
304 <td class="source"><a href="#l4" id="l4"> 4</a> </td>
304 <td class="source"><a href="#l4"> 4</a> </td>
305 305 </tr>
306 <tr>
306 <tr id="l5">
307 307 <td class="annotate">
308 308 <a href="/annotate/853dcd4de2a6/primes.py#l5"
309 309 title="853dcd4de2a6: a">test@0</a>
310 310 </td>
311 <td class="source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
311 <td class="source"><a href="#l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
312 312 </tr>
313 <tr>
313 <tr id="l6">
314 314 <td class="annotate">
315 315 <a href="/annotate/853dcd4de2a6/primes.py#l6"
316 316 title="853dcd4de2a6: a">test@0</a>
317 317 </td>
318 <td class="source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></td>
318 <td class="source"><a href="#l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></td>
319 319 </tr>
320 <tr>
320 <tr id="l7">
321 321 <td class="annotate">
322 322 <a href="/annotate/853dcd4de2a6/primes.py#l7"
323 323 title="853dcd4de2a6: a">test@0</a>
324 324 </td>
325 <td class="source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></td>
325 <td class="source"><a href="#l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></td>
326 326 </tr>
327 <tr>
327 <tr id="l8">
328 328 <td class="annotate">
329 329 <a href="/annotate/853dcd4de2a6/primes.py#l8"
330 330 title="853dcd4de2a6: a">test@0</a>
331 331 </td>
332 <td class="source"><a href="#l8" id="l8"> 8</a> </td>
332 <td class="source"><a href="#l8"> 8</a> </td>
333 333 </tr>
334 <tr>
334 <tr id="l9">
335 335 <td class="annotate">
336 336 <a href="/annotate/853dcd4de2a6/primes.py#l9"
337 337 title="853dcd4de2a6: a">test@0</a>
338 338 </td>
339 <td class="source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
339 <td class="source"><a href="#l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
340 340 </tr>
341 <tr>
341 <tr id="l10">
342 342 <td class="annotate">
343 343 <a href="/annotate/853dcd4de2a6/primes.py#l10"
344 344 title="853dcd4de2a6: a">test@0</a>
345 345 </td>
346 <td class="source"><a href="#l10" id="l10"> 10</a> </td>
346 <td class="source"><a href="#l10"> 10</a> </td>
347 347 </tr>
348 <tr>
348 <tr id="l11">
349 349 <td class="annotate">
350 350 <a href="/annotate/853dcd4de2a6/primes.py#l11"
351 351 title="853dcd4de2a6: a">test@0</a>
352 352 </td>
353 <td class="source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
353 <td class="source"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
354 354 </tr>
355 <tr>
355 <tr id="l12">
356 356 <td class="annotate">
357 357 <a href="/annotate/853dcd4de2a6/primes.py#l12"
358 358 title="853dcd4de2a6: a">test@0</a>
359 359 </td>
360 <td class="source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
360 <td class="source"><a href="#l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
361 361 </tr>
362 <tr>
362 <tr id="l13">
363 363 <td class="annotate">
364 364 <a href="/annotate/853dcd4de2a6/primes.py#l13"
365 365 title="853dcd4de2a6: a">test@0</a>
366 366 </td>
367 <td class="source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
367 <td class="source"><a href="#l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
368 368 </tr>
369 <tr>
369 <tr id="l14">
370 370 <td class="annotate">
371 371 <a href="/annotate/853dcd4de2a6/primes.py#l14"
372 372 title="853dcd4de2a6: a">test@0</a>
373 373 </td>
374 <td class="source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
374 <td class="source"><a href="#l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
375 375 </tr>
376 <tr>
376 <tr id="l15">
377 377 <td class="annotate">
378 378 <a href="/annotate/853dcd4de2a6/primes.py#l15"
379 379 title="853dcd4de2a6: a">test@0</a>
380 380 </td>
381 <td class="source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
381 <td class="source"><a href="#l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
382 382 </tr>
383 <tr>
383 <tr id="l16">
384 384 <td class="annotate">
385 385 <a href="/annotate/853dcd4de2a6/primes.py#l16"
386 386 title="853dcd4de2a6: a">test@0</a>
387 387 </td>
388 <td class="source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></td>
388 <td class="source"><a href="#l16"> 16</a> <span class="c"># infinite recursion.</span></td>
389 389 </tr>
390 <tr>
390 <tr id="l17">
391 391 <td class="annotate">
392 392 <a href="/annotate/853dcd4de2a6/primes.py#l17"
393 393 title="853dcd4de2a6: a">test@0</a>
394 394 </td>
395 <td class="source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
395 <td class="source"><a href="#l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
396 396 </tr>
397 <tr>
397 <tr id="l18">
398 398 <td class="annotate">
399 399 <a href="/annotate/853dcd4de2a6/primes.py#l18"
400 400 title="853dcd4de2a6: a">test@0</a>
401 401 </td>
402 <td class="source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mf">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
402 <td class="source"><a href="#l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mf">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
403 403 </tr>
404 <tr>
404 <tr id="l19">
405 405 <td class="annotate">
406 406 <a href="/annotate/853dcd4de2a6/primes.py#l19"
407 407 title="853dcd4de2a6: a">test@0</a>
408 408 </td>
409 <td class="source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
409 <td class="source"><a href="#l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
410 410 </tr>
411 <tr>
411 <tr id="l20">
412 412 <td class="annotate">
413 413 <a href="/annotate/853dcd4de2a6/primes.py#l20"
414 414 title="853dcd4de2a6: a">test@0</a>
415 415 </td>
416 <td class="source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
416 <td class="source"><a href="#l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
417 417 </tr>
418 <tr>
418 <tr id="l21">
419 419 <td class="annotate">
420 420 <a href="/annotate/853dcd4de2a6/primes.py#l21"
421 421 title="853dcd4de2a6: a">test@0</a>
422 422 </td>
423 <td class="source"><a href="#l21" id="l21"> 21</a> </td>
423 <td class="source"><a href="#l21"> 21</a> </td>
424 424 </tr>
425 <tr>
425 <tr id="l22">
426 426 <td class="annotate">
427 427 <a href="/annotate/853dcd4de2a6/primes.py#l22"
428 428 title="853dcd4de2a6: a">test@0</a>
429 429 </td>
430 <td class="source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mf">2</span> <span class="o">==</span> <span class="mf">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
430 <td class="source"><a href="#l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mf">2</span> <span class="o">==</span> <span class="mf">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
431 431 </tr>
432 <tr>
432 <tr id="l23">
433 433 <td class="annotate">
434 434 <a href="/annotate/853dcd4de2a6/primes.py#l23"
435 435 title="853dcd4de2a6: a">test@0</a>
436 436 </td>
437 <td class="source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mf">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mf">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
437 <td class="source"><a href="#l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mf">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mf">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
438 438 </tr>
439 <tr>
439 <tr id="l24">
440 440 <td class="annotate">
441 441 <a href="/annotate/853dcd4de2a6/primes.py#l24"
442 442 title="853dcd4de2a6: a">test@0</a>
443 443 </td>
444 <td class="source"><a href="#l24" id="l24"> 24</a> </td>
444 <td class="source"><a href="#l24"> 24</a> </td>
445 445 </tr>
446 <tr>
446 <tr id="l25">
447 447 <td class="annotate">
448 448 <a href="/annotate/853dcd4de2a6/primes.py#l25"
449 449 title="853dcd4de2a6: a">test@0</a>
450 450 </td>
451 <td class="source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></td>
451 <td class="source"><a href="#l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></td>
452 452 </tr>
453 <tr>
453 <tr id="l26">
454 454 <td class="annotate">
455 455 <a href="/annotate/853dcd4de2a6/primes.py#l26"
456 456 title="853dcd4de2a6: a">test@0</a>
457 457 </td>
458 <td class="source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
458 <td class="source"><a href="#l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
459 459 </tr>
460 <tr>
460 <tr id="l27">
461 461 <td class="annotate">
462 462 <a href="/annotate/853dcd4de2a6/primes.py#l27"
463 463 title="853dcd4de2a6: a">test@0</a>
464 464 </td>
465 <td class="source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
465 <td class="source"><a href="#l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
466 466 </tr>
467 <tr>
467 <tr id="l28">
468 468 <td class="annotate">
469 469 <a href="/annotate/853dcd4de2a6/primes.py#l28"
470 470 title="853dcd4de2a6: a">test@0</a>
471 471 </td>
472 <td class="source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</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></td>
472 <td class="source"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</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></td>
473 473 </tr>
474 <tr>
474 <tr id="l29">
475 475 <td class="annotate">
476 476 <a href="/annotate/853dcd4de2a6/primes.py#l29"
477 477 title="853dcd4de2a6: a">test@0</a>
478 478 </td>
479 <td class="source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
479 <td class="source"><a href="#l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
480 480 </tr>
481 <tr>
481 <tr id="l30">
482 482 <td class="annotate">
483 483 <a href="/annotate/853dcd4de2a6/primes.py#l30"
484 484 title="853dcd4de2a6: a">test@0</a>
485 485 </td>
486 <td class="source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mf">10</span></td>
486 <td class="source"><a href="#l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mf">10</span></td>
487 487 </tr>
488 <tr>
488 <tr id="l31">
489 489 <td class="annotate">
490 490 <a href="/annotate/853dcd4de2a6/primes.py#l31"
491 491 title="853dcd4de2a6: a">test@0</a>
492 492 </td>
493 <td class="source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
493 <td class="source"><a href="#l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
494 494 </tr>
495 <tr>
495 <tr id="l32">
496 496 <td class="annotate">
497 497 <a href="/annotate/853dcd4de2a6/primes.py#l32"
498 498 title="853dcd4de2a6: a">test@0</a>
499 499 </td>
500 <td class="source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
500 <td class="source"><a href="#l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
501 501 </tr>
502 502 </tbody>
503 503 </table>
504 504 </div>
505 505 </div>
506 506 </div>
507 507
508 508 <script type="text/javascript">process_dates()</script>
509 509
510 510
511 511 </body>
512 512 </html>
513 513
514 514
515 515 hgweb fileannotate, raw
516 516
517 517 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT 'annotate/tip/primes.py?style=raw') \
518 518 > | sed "s/test@//" > a
519 519 $ echo "200 Script output follows" > b
520 520 $ echo "" >> b
521 521 $ echo "" >> b
522 522 $ hg annotate "primes.py" >> b
523 523 $ echo "" >> b
524 524 $ echo "" >> b
525 525 $ echo "" >> b
526 526 $ echo "" >> b
527 527 $ diff -u b a
528 528
529 529 hgweb filerevision, raw
530 530
531 531 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT 'file/tip/primes.py?style=raw') \
532 532 > > a
533 533 $ echo "200 Script output follows" > b
534 534 $ echo "" >> b
535 535 $ hg cat primes.py >> b
536 536 $ diff -u b a
537 537
538 538 hgweb highlightcss friendly
539 539
540 540 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'highlightcss' > out
541 541 $ head -n 4 out
542 542 200 Script output follows
543 543
544 544 /* pygments_style = friendly */
545 545
546 546 $ rm out
547 547
548 548 errors encountered
549 549
550 550 $ cat errors.log
551 551 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
552 552
553 553 Change the pygments style
554 554
555 555 $ cat > .hg/hgrc <<EOF
556 556 > [web]
557 557 > pygments_style = fruity
558 558 > EOF
559 559
560 560 hg serve again
561 561
562 562 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
563 563 $ cat hg.pid >> $DAEMON_PIDS
564 564
565 565 hgweb highlightcss fruity
566 566
567 567 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'highlightcss' > out
568 568 $ head -n 4 out
569 569 200 Script output follows
570 570
571 571 /* pygments_style = fruity */
572 572
573 573 $ rm out
574 574
575 575 errors encountered
576 576
577 577 $ cat errors.log
578 578 $ cd ..
579 579 $ hg init eucjp
580 580 $ cd eucjp
581 581 $ python -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo"
582 582 $ hg ci -Ama
583 583 adding eucjp.txt
584 584 $ hgserveget () {
585 585 > "$TESTDIR/killdaemons.py" $DAEMON_PIDS
586 586 > echo % HGENCODING="$1" hg serve
587 587 > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
588 588 > cat hg.pid >> $DAEMON_PIDS
589 589 >
590 590 > echo % hgweb filerevision, html
591 591 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "file/tip/$2" \
592 592 > | grep '<div class="parity0 source">'
593 593 > echo % errors encountered
594 594 > cat errors.log
595 595 > }
596 596 $ hgserveget euc-jp eucjp.txt
597 597 % HGENCODING=euc-jp hg serve
598 598 % hgweb filerevision, html
599 599 % errors encountered
600 600 $ hgserveget utf-8 eucjp.txt
601 601 % HGENCODING=utf-8 hg serve
602 602 % hgweb filerevision, html
603 603 % errors encountered
604 604 $ hgserveget us-ascii eucjp.txt
605 605 % HGENCODING=us-ascii hg serve
606 606 % hgweb filerevision, html
607 607 % errors encountered
608 608
609 609 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now