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