annotate tests/test-highlight.t @ 12445:981ce49a243f

tests: unify test-highlight
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Sep 2010 13:41:32 -0500
parents tests/test-highlight@a9c0d6060827
children d664547ef540
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6355
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
1
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
2 $ "$TESTDIR/hghave" pygments || exit 80
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
3 $ cat <<EOF >> $HGRCPATH
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
4 > [extensions]
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
5 > highlight =
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
6 > [web]
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
7 > pygments_style = friendly
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
8 > EOF
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
9 $ hg init test
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
10 $ cd test
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
11
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
12 create random Python file to exercise Pygments
6355
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
13
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
14 $ cat <<EOF > primes.py
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
15 > #!/usr/bin/env python
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
16 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
17 > """Fun with generators. Corresponding Haskell implementation:
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
18 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
19 > primes = 2 : sieve [3, 5..]
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
20 > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
21 > """
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
22 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
23 > from itertools import dropwhile, ifilter, islice, count, chain
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
24 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
25 > def primes():
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
26 > """Generate all primes."""
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
27 > def sieve(ns):
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
28 > p = ns.next()
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
29 > # It is important to yield *here* in order to stop the
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
30 > # infinite recursion.
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
31 > yield p
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
32 > ns = ifilter(lambda n: n % p != 0, ns)
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
33 > for n in sieve(ns):
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
34 > yield n
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
35 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
36 > odds = ifilter(lambda i: i % 2 == 1, count())
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
37 > return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
38 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
39 > if __name__ == "__main__":
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
40 > import sys
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
41 > try:
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
42 > n = int(sys.argv[1])
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
43 > except (ValueError, IndexError):
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
44 > n = 10
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
45 > p = primes()
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
46 > print "The first %d primes: %s" % (n, list(islice(p, n)))
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
47 > EOF
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
48 $ hg ci -Ama
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
49 adding primes.py
8485
0b93eff3721d test-highlight: decouple test from get-with-headers.py
Martin Geisler <mg@lazybytes.net>
parents: 8083
diff changeset
50
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
51 hg serve
8485
0b93eff3721d test-highlight: decouple test from get-with-headers.py
Martin Geisler <mg@lazybytes.net>
parents: 8083
diff changeset
52
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
53 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
54 $ cat hg.pid >> $DAEMON_PIDS
8485
0b93eff3721d test-highlight: decouple test from get-with-headers.py
Martin Geisler <mg@lazybytes.net>
parents: 8083
diff changeset
55
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
56 hgweb filerevision, html
8485
0b93eff3721d test-highlight: decouple test from get-with-headers.py
Martin Geisler <mg@lazybytes.net>
parents: 8083
diff changeset
57
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
58 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py') \
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
59 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
60 200 Script output follows
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
61
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
62 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
63 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
64 <head>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
65 <link rel="icon" href="/static/hgicon.png" type="image/png" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
66 <meta name="robots" content="index, nofollow" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
67 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
68
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
69 <link rel="stylesheet" href="/highlightcss" type="text/css" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
70 <title>test: 853dcd4de2a6 primes.py</title>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
71 </head>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
72 <body>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
73
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
74 <div class="container">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
75 <div class="menu">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
76 <div class="logo">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
77 <a href="http://mercurial.selenic.com/">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
78 <img src="/static/hglogo.png" alt="mercurial" /></a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
79 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
80 <ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
81 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
82 <li><a href="/graph/853dcd4de2a6">graph</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
83 <li><a href="/tags">tags</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
84 <li><a href="/branches">branches</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
85 </ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
86 <ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
87 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
88 <li><a href="/file/853dcd4de2a6/">browse</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
89 </ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
90 <ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
91 <li class="active">file</li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
92 <li><a href="/file/tip/primes.py">latest</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
93 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
94 <li><a href="/annotate/853dcd4de2a6/primes.py">annotate</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
95 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
96 <li><a href="/raw-file/853dcd4de2a6/primes.py">raw</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
97 </ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
98 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
99
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
100 <div class="main">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
101 <h2><a href="/">test</a></h2>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
102 <h3>view primes.py @ 0:853dcd4de2a6</h3>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
103
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
104 <form class="search" action="/log">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
105
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
106 <p><input name="rev" id="search1" type="text" size="30" /></p>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
107 <div id="hint">find changesets by author, revision,
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
108 files, or words in the commit message</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
109 </form>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
110
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
111 <div class="description">a</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
112
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
113 <table id="changesetEntry">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
114 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
115 <th class="author">author</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
116 <td class="author">&#116;&#101;&#115;&#116;</td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
117 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
118 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
119 <th class="date">date</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
120 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
121 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
122 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
123 <th class="author">parents</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
124 <td class="author"></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
125 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
126 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
127 <th class="author">children</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
128 <td class="author"></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
129 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
130
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
131 </table>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
132
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
133 <div class="overflow">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
134 <div class="sourcefirst"> line source</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
135
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
136 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
137 <div class="parity1 source"><a href="#l2" id="l2"> 2</a> </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
138 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
139 <div class="parity1 source"><a href="#l4" id="l4"> 4</a> </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
140 <div class="parity0 source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
141 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
142 <div class="parity0 source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
143 <div class="parity1 source"><a href="#l8" id="l8"> 8</a> </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
144 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
145 <div class="parity1 source"><a href="#l10" id="l10"> 10</a> </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
146 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
147 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
148 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
149 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
150 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
151 <div class="parity1 source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
152 <div class="parity0 source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
153 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
154 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
155 <div class="parity1 source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
156 <div class="parity0 source"><a href="#l21" id="l21"> 21</a> </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
157 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
158 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
159 <div class="parity1 source"><a href="#l24" id="l24"> 24</a> </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
160 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
161 <div class="parity1 source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
162 <div class="parity0 source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
163 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
164 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
165 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
166 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
167 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
168 <div class="sourcelast"></div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
169 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
170 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
171 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
172
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
173
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
174
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
175 </body>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
176 </html>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
177
8485
0b93eff3721d test-highlight: decouple test from get-with-headers.py
Martin Geisler <mg@lazybytes.net>
parents: 8083
diff changeset
178
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
179 hgweb fileannotate, html
6987
d09e813b21e3 highlight: only pygmentize for HTML mimetypes
Rocco Rutte <pdmef@gmx.net>
parents: 6863
diff changeset
180
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
181 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py') \
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
182 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mi\"/class=\"mf\"/g"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
183 200 Script output follows
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
184
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
185 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
186 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
187 <head>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
188 <link rel="icon" href="/static/hgicon.png" type="image/png" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
189 <meta name="robots" content="index, nofollow" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
190 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
191
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
192 <link rel="stylesheet" href="/highlightcss" type="text/css" />
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
193 <title>test: primes.py annotate</title>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
194 </head>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
195 <body>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
196
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
197 <div class="container">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
198 <div class="menu">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
199 <div class="logo">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
200 <a href="http://mercurial.selenic.com/">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
201 <img src="/static/hglogo.png" alt="mercurial" /></a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
202 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
203 <ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
204 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
205 <li><a href="/graph/853dcd4de2a6">graph</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
206 <li><a href="/tags">tags</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
207 <li><a href="/branches">branches</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
208 </ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
209
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
210 <ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
211 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
212 <li><a href="/file/853dcd4de2a6/">browse</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
213 </ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
214 <ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
215 <li><a href="/file/853dcd4de2a6/primes.py">file</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
216 <li><a href="/file/tip/primes.py">latest</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
217 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
218 <li class="active">annotate</li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
219 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
220 <li><a href="/raw-annotate/853dcd4de2a6/primes.py">raw</a></li>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
221 </ul>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
222 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
223
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
224 <div class="main">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
225 <h2><a href="/">test</a></h2>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
226 <h3>annotate primes.py @ 0:853dcd4de2a6</h3>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
227
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
228 <form class="search" action="/log">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
229
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
230 <p><input name="rev" id="search1" type="text" size="30" /></p>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
231 <div id="hint">find changesets by author, revision,
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
232 files, or words in the commit message</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
233 </form>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
234
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
235 <div class="description">a</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
236
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
237 <table id="changesetEntry">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
238 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
239 <th class="author">author</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
240 <td class="author">&#116;&#101;&#115;&#116;</td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
241 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
242 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
243 <th class="date">date</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
244 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
245 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
246 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
247 <th class="author">parents</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
248 <td class="author"></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
249 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
250 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
251 <th class="author">children</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
252 <td class="author"></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
253 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
254
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
255 </table>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
256
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
257 <div class="overflow">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
258 <table class="bigtable">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
259 <tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
260 <th class="annotate">rev</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
261 <th class="line">&nbsp;&nbsp;line source</th>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
262 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
263
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
264 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
265 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
266 <a href="/annotate/853dcd4de2a6/primes.py#1"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
267 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
268 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
269 <td class="source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
270 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
271 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
272 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
273 <a href="/annotate/853dcd4de2a6/primes.py#2"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
274 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
275 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
276 <td class="source"><a href="#l2" id="l2"> 2</a> </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
277 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
278 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
279 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
280 <a href="/annotate/853dcd4de2a6/primes.py#3"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
281 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
282 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
283 <td class="source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
284 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
285 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
286 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
287 <a href="/annotate/853dcd4de2a6/primes.py#4"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
288 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
289 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
290 <td class="source"><a href="#l4" id="l4"> 4</a> </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
291 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
292 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
293 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
294 <a href="/annotate/853dcd4de2a6/primes.py#5"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
295 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
296 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
297 <td class="source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
298 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
299 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
300 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
301 <a href="/annotate/853dcd4de2a6/primes.py#6"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
302 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
303 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
304 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
305 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
306 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
307 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
308 <a href="/annotate/853dcd4de2a6/primes.py#7"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
309 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
310 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
311 <td class="source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
312 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
313 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
314 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
315 <a href="/annotate/853dcd4de2a6/primes.py#8"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
316 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
317 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
318 <td class="source"><a href="#l8" id="l8"> 8</a> </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
319 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
320 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
321 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
322 <a href="/annotate/853dcd4de2a6/primes.py#9"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
323 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
324 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
325 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
326 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
327 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
328 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
329 <a href="/annotate/853dcd4de2a6/primes.py#10"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
330 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
331 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
332 <td class="source"><a href="#l10" id="l10"> 10</a> </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
333 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
334 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
335 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
336 <a href="/annotate/853dcd4de2a6/primes.py#11"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
337 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
338 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
339 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
340 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
341 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
342 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
343 <a href="/annotate/853dcd4de2a6/primes.py#12"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
344 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
345 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
346 <td class="source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
347 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
348 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
349 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
350 <a href="/annotate/853dcd4de2a6/primes.py#13"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
351 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
352 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
353 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
354 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
355 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
356 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
357 <a href="/annotate/853dcd4de2a6/primes.py#14"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
358 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
359 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
360 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
361 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
362 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
363 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
364 <a href="/annotate/853dcd4de2a6/primes.py#15"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
365 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
366 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
367 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
368 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
369 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
370 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
371 <a href="/annotate/853dcd4de2a6/primes.py#16"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
372 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
373 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
374 <td class="source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
375 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
376 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
377 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
378 <a href="/annotate/853dcd4de2a6/primes.py#17"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
379 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
380 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
381 <td class="source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
382 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
383 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
384 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
385 <a href="/annotate/853dcd4de2a6/primes.py#18"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
386 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
387 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
388 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
389 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
390 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
391 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
392 <a href="/annotate/853dcd4de2a6/primes.py#19"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
393 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
394 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
395 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
396 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
397 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
398 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
399 <a href="/annotate/853dcd4de2a6/primes.py#20"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
400 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
401 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
402 <td class="source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
403 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
404 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
405 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
406 <a href="/annotate/853dcd4de2a6/primes.py#21"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
407 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
408 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
409 <td class="source"><a href="#l21" id="l21"> 21</a> </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
410 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
411 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
412 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
413 <a href="/annotate/853dcd4de2a6/primes.py#22"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
414 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
415 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
416 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
417 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
418 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
419 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
420 <a href="/annotate/853dcd4de2a6/primes.py#23"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
421 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
422 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
423 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
424 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
425 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
426 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
427 <a href="/annotate/853dcd4de2a6/primes.py#24"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
428 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
429 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
430 <td class="source"><a href="#l24" id="l24"> 24</a> </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
431 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
432 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
433 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
434 <a href="/annotate/853dcd4de2a6/primes.py#25"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
435 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
436 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
437 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
438 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
439 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
440 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
441 <a href="/annotate/853dcd4de2a6/primes.py#26"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
442 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
443 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
444 <td class="source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
445 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
446 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
447 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
448 <a href="/annotate/853dcd4de2a6/primes.py#27"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
449 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
450 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
451 <td class="source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
452 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
453 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
454 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
455 <a href="/annotate/853dcd4de2a6/primes.py#28"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
456 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
457 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
458 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
459 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
460 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
461 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
462 <a href="/annotate/853dcd4de2a6/primes.py#29"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
463 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
464 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
465 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
466 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
467 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
468 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
469 <a href="/annotate/853dcd4de2a6/primes.py#30"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
470 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
471 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
472 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
473 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
474 <tr class="parity0">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
475 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
476 <a href="/annotate/853dcd4de2a6/primes.py#31"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
477 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
478 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
479 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
480 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
481 <tr class="parity1">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
482 <td class="annotate">
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
483 <a href="/annotate/853dcd4de2a6/primes.py#32"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
484 title="853dcd4de2a6: a">test@0</a>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
485 </td>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
486 <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>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
487 </tr>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
488 </table>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
489 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
490 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
491 </div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
492
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
493
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
494
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
495 </body>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
496 </html>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
497
6485
938319418d8c highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents: 6355
diff changeset
498
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
499 hgweb fileannotate, raw
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
500
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
501 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py?style=raw') \
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
502 > | sed "s/test@//" > a
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
503 $ echo "200 Script output follows" > b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
504 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
505 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
506 $ hg annotate "primes.py" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
507 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
508 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
509 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
510 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
511 $ diff -u b a
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
512 $ echo
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
513
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
514
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
515 hgweb filerevision, raw
6485
938319418d8c highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents: 6355
diff changeset
516
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
517 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py?style=raw') \
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
518 > > a
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
519 $ echo "200 Script output follows" > b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
520 $ echo "" >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
521 $ hg cat primes.py >> b
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
522 $ diff -u b a
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
523 $ echo
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
524
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
525
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
526 hgweb highlightcss friendly
6485
938319418d8c highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents: 6355
diff changeset
527
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
528 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
529 $ head -n 4 out
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
530 200 Script output follows
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
531
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
532 /* pygments_style = friendly */
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
533
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
534 $ rm out
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
535
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
536 errors encountered
6485
938319418d8c highlight: Generate pygments style sheet dynamically
Isaac Jurado <diptongo@gmail.com>
parents: 6355
diff changeset
537
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
538 $ cat errors.log
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
539 $ "$TESTDIR/killdaemons.py"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
540
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
541 Change the pygments style
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
542
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
543 $ cat > .hg/hgrc <<EOF
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
544 > [web]
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
545 > pygments_style = fruity
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
546 > EOF
9424
799373ff2554 highlight: fixes garbled text in non-UTF-8 environment
Yuya Nishihara <yuya@tcha.org>
parents: 8485
diff changeset
547
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
548 hg serve again
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
549
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
550 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
551 $ cat hg.pid >> $DAEMON_PIDS
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
552
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
553 hgweb highlightcss fruity
9424
799373ff2554 highlight: fixes garbled text in non-UTF-8 environment
Yuya Nishihara <yuya@tcha.org>
parents: 8485
diff changeset
554
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
555 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
556 $ head -n 4 out
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
557 200 Script output follows
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
558
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
559 /* pygments_style = fruity */
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
560
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
561 $ rm out
9424
799373ff2554 highlight: fixes garbled text in non-UTF-8 environment
Yuya Nishihara <yuya@tcha.org>
parents: 8485
diff changeset
562
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
563 errors encountered
9424
799373ff2554 highlight: fixes garbled text in non-UTF-8 environment
Yuya Nishihara <yuya@tcha.org>
parents: 8485
diff changeset
564
12445
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
565 $ cat errors.log
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
566 $ cd ..
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
567 $ hg init eucjp
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
568 $ cd eucjp
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
569 $ python -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
570 $ hg ci -Ama
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
571 adding eucjp.txt
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
572 $ hgserveget () {
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
573 > "$TESTDIR/killdaemons.py"
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
574 > echo % HGENCODING="$1" hg serve
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
575 > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
576 > cat hg.pid >> $DAEMON_PIDS
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
577 >
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
578 > echo % hgweb filerevision, html
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
579 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/file/tip/$2" \
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
580 > | grep '<div class="parity0 source">' | $TESTDIR/printrepr.py
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
581 > echo % errors encountered
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
582 > cat errors.log
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
583 > }
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
584 $ hgserveget euc-jp eucjp.txt
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
585 % HGENCODING=euc-jp hg serve
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
586 % hgweb filerevision, html
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
587 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
588 % errors encountered
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
589 $ hgserveget utf-8 eucjp.txt
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
590 % HGENCODING=utf-8 hg serve
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
591 % hgweb filerevision, html
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
592 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
593 % errors encountered
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
594 $ hgserveget us-ascii eucjp.txt
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
595 % HGENCODING=us-ascii hg serve
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
596 % hgweb filerevision, html
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
597 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> ??</div>
981ce49a243f tests: unify test-highlight
Matt Mackall <mpm@selenic.com>
parents: 10257
diff changeset
598 % errors encountered