comparison tests/test-hgweb-diffs.t @ 12435:61be1503cfb2

tests: unify test-hgweb-diffs
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Sep 2010 13:41:32 -0500
parents tests/test-hgweb-diffs@ffda19f351fa
children ead4e21f49f1
comparison
equal deleted inserted replaced
12434:3cf40f64f9f6 12435:61be1503cfb2
1 setting up repo
2
3 $ hg init test
4 $ cd test
5 $ echo a > a
6 $ echo b > b
7 $ hg ci -Ama
8 adding a
9 adding b
10
11 change permissions for git diffs
12
13 $ chmod 755 a
14 $ hg ci -Amb
15
16 set up hgweb
17
18 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
19 $ cat hg.pid >> $DAEMON_PIDS
20
21 revision
22
23 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0'
24 200 Script output follows
25
26 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
27 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
28 <head>
29 <link rel="icon" href="/static/hgicon.png" type="image/png" />
30 <meta name="robots" content="index, nofollow" />
31 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
32
33 <title>test: 0cd96de13884</title>
34 </head>
35 <body>
36 <div class="container">
37 <div class="menu">
38 <div class="logo">
39 <a href="http://mercurial.selenic.com/">
40 <img src="/static/hglogo.png" alt="mercurial" /></a>
41 </div>
42 <ul>
43 <li><a href="/shortlog/0cd96de13884">log</a></li>
44 <li><a href="/graph/0cd96de13884">graph</a></li>
45 <li><a href="/tags">tags</a></li>
46 <li><a href="/branches">branches</a></li>
47 </ul>
48 <ul>
49 <li class="active">changeset</li>
50 <li><a href="/raw-rev/0cd96de13884">raw</a></li>
51 <li><a href="/file/0cd96de13884">browse</a></li>
52 </ul>
53 <ul>
54
55 </ul>
56 </div>
57
58 <div class="main">
59
60 <h2><a href="/">test</a></h2>
61 <h3>changeset 0:0cd96de13884 </h3>
62
63 <form class="search" action="/log">
64
65 <p><input name="rev" id="search1" type="text" size="30" /></p>
66 <div id="hint">find changesets by author, revision,
67 files, or words in the commit message</div>
68 </form>
69
70 <div class="description">a</div>
71
72 <table id="changesetEntry">
73 <tr>
74 <th class="author">author</th>
75 <td class="author">&#116;&#101;&#115;&#116;</td>
76 </tr>
77 <tr>
78 <th class="date">date</th>
79 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td></tr>
80 <tr>
81 <th class="author">parents</th>
82 <td class="author"></td>
83 </tr>
84 <tr>
85 <th class="author">children</th>
86 <td class="author"> <a href="/rev/78e4ebad7cdf">78e4ebad7cdf</a></td>
87 </tr>
88 <tr>
89 <th class="files">files</th>
90 <td class="files"><a href="/file/0cd96de13884/a">a</a> <a href="/file/0cd96de13884/b">b</a> </td>
91 </tr>
92 </table>
93
94 <div class="overflow">
95 <div class="sourcefirst"> line diff</div>
96
97 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
98 </span><a href="#l1.2" id="l1.2"> 1.2</a> <span class="plusline">+++ b/a Thu Jan 01 00:00:00 1970 +0000
99 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="atline">@@ -0,0 +1,1 @@
100 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="plusline">+a
101 </span></pre></div><div class="source bottomline parity1"><pre><a href="#l2.1" id="l2.1"> 2.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
102 </span><a href="#l2.2" id="l2.2"> 2.2</a> <span class="plusline">+++ b/b Thu Jan 01 00:00:00 1970 +0000
103 </span><a href="#l2.3" id="l2.3"> 2.3</a> <span class="atline">@@ -0,0 +1,1 @@
104 </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="plusline">+b
105 </span></pre></div>
106 </div>
107
108 </div>
109 </div>
110
111
112 </body>
113 </html>
114
115
116 raw revision
117
118 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-rev/0'
119 200 Script output follows
120
121
122 # HG changeset patch
123 # User test
124 # Date 0 0
125 # Node ID 0cd96de13884b090099512d4794ae87ad067ea8e
126
127 a
128
129 diff -r 000000000000 -r 0cd96de13884 a
130 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
131 +++ b/a Thu Jan 01 00:00:00 1970 +0000
132 @@ -0,0 +1,1 @@
133 +a
134 diff -r 000000000000 -r 0cd96de13884 b
135 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
136 +++ b/b Thu Jan 01 00:00:00 1970 +0000
137 @@ -0,0 +1,1 @@
138 +b
139
140
141 diff removed file
142
143 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a'
144 200 Script output follows
145
146 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
147 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
148 <head>
149 <link rel="icon" href="/static/hgicon.png" type="image/png" />
150 <meta name="robots" content="index, nofollow" />
151 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
152
153 <title>test: a diff</title>
154 </head>
155 <body>
156
157 <div class="container">
158 <div class="menu">
159 <div class="logo">
160 <a href="http://mercurial.selenic.com/">
161 <img src="/static/hglogo.png" alt="mercurial" /></a>
162 </div>
163 <ul>
164 <li><a href="/shortlog/78e4ebad7cdf">log</a></li>
165 <li><a href="/graph/78e4ebad7cdf">graph</a></li>
166 <li><a href="/tags">tags</a></li>
167 <li><a href="/branches">branches</a></li>
168 </ul>
169 <ul>
170 <li><a href="/rev/78e4ebad7cdf">changeset</a></li>
171 <li><a href="/file/78e4ebad7cdf">browse</a></li>
172 </ul>
173 <ul>
174 <li><a href="/file/78e4ebad7cdf/a">file</a></li>
175 <li><a href="/file/tip/a">latest</a></li>
176 <li class="active">diff</li>
177 <li><a href="/annotate/78e4ebad7cdf/a">annotate</a></li>
178 <li><a href="/log/78e4ebad7cdf/a">file log</a></li>
179 <li><a href="/raw-file/78e4ebad7cdf/a">raw</a></li>
180 </ul>
181 </div>
182
183 <div class="main">
184 <h2><a href="/">test</a></h2>
185 <h3>diff a @ 1:78e4ebad7cdf</h3>
186
187 <form class="search" action="/log">
188 <p></p>
189 <p><input name="rev" id="search1" type="text" size="30" /></p>
190 <div id="hint">find changesets by author, revision,
191 files, or words in the commit message</div>
192 </form>
193
194 <div class="description">b</div>
195
196 <table id="changesetEntry">
197 <tr>
198 <th>author</th>
199 <td>&#116;&#101;&#115;&#116;</td>
200 </tr>
201 <tr>
202 <th>date</th>
203 <td>Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
204 </tr>
205 <tr>
206 <th>parents</th>
207 <td></td>
208 </tr>
209 <tr>
210 <th>children</th>
211 <td></td>
212 </tr>
213
214 </table>
215
216 <div class="overflow">
217 <div class="sourcefirst"> line diff</div>
218
219 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
220 </span><a href="#l1.2" id="l1.2"> 1.2</a> <span class="plusline">+++ b/a Thu Jan 01 00:00:00 1970 +0000
221 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="atline">@@ -0,0 +1,1 @@
222 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="plusline">+a
223 </span></pre></div>
224 </div>
225 </div>
226 </div>
227
228
229
230 </body>
231 </html>
232
233
234 set up hgweb with git diffs
235
236 $ "$TESTDIR/killdaemons.py"
237 $ hg serve --config 'diff.git=1' -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
238 $ cat hg.pid >> $DAEMON_PIDS
239
240 revision
241
242 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0'
243 200 Script output follows
244
245 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
246 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
247 <head>
248 <link rel="icon" href="/static/hgicon.png" type="image/png" />
249 <meta name="robots" content="index, nofollow" />
250 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
251
252 <title>test: 0cd96de13884</title>
253 </head>
254 <body>
255 <div class="container">
256 <div class="menu">
257 <div class="logo">
258 <a href="http://mercurial.selenic.com/">
259 <img src="/static/hglogo.png" alt="mercurial" /></a>
260 </div>
261 <ul>
262 <li><a href="/shortlog/0cd96de13884">log</a></li>
263 <li><a href="/graph/0cd96de13884">graph</a></li>
264 <li><a href="/tags">tags</a></li>
265 <li><a href="/branches">branches</a></li>
266 </ul>
267 <ul>
268 <li class="active">changeset</li>
269 <li><a href="/raw-rev/0cd96de13884">raw</a></li>
270 <li><a href="/file/0cd96de13884">browse</a></li>
271 </ul>
272 <ul>
273
274 </ul>
275 </div>
276
277 <div class="main">
278
279 <h2><a href="/">test</a></h2>
280 <h3>changeset 0:0cd96de13884 </h3>
281
282 <form class="search" action="/log">
283
284 <p><input name="rev" id="search1" type="text" size="30" /></p>
285 <div id="hint">find changesets by author, revision,
286 files, or words in the commit message</div>
287 </form>
288
289 <div class="description">a</div>
290
291 <table id="changesetEntry">
292 <tr>
293 <th class="author">author</th>
294 <td class="author">&#116;&#101;&#115;&#116;</td>
295 </tr>
296 <tr>
297 <th class="date">date</th>
298 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td></tr>
299 <tr>
300 <th class="author">parents</th>
301 <td class="author"></td>
302 </tr>
303 <tr>
304 <th class="author">children</th>
305 <td class="author"> <a href="/rev/78e4ebad7cdf">78e4ebad7cdf</a></td>
306 </tr>
307 <tr>
308 <th class="files">files</th>
309 <td class="files"><a href="/file/0cd96de13884/a">a</a> <a href="/file/0cd96de13884/b">b</a> </td>
310 </tr>
311 </table>
312
313 <div class="overflow">
314 <div class="sourcefirst"> line diff</div>
315
316 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> new file mode 100644
317 <a href="#l1.2" id="l1.2"> 1.2</a> <span class="minusline">--- /dev/null
318 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="plusline">+++ b/a
319 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="atline">@@ -0,0 +1,1 @@
320 </span><a href="#l1.5" id="l1.5"> 1.5</a> <span class="plusline">+a
321 </span></pre></div><div class="source bottomline parity1"><pre><a href="#l2.1" id="l2.1"> 2.1</a> new file mode 100644
322 <a href="#l2.2" id="l2.2"> 2.2</a> <span class="minusline">--- /dev/null
323 </span><a href="#l2.3" id="l2.3"> 2.3</a> <span class="plusline">+++ b/b
324 </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="atline">@@ -0,0 +1,1 @@
325 </span><a href="#l2.5" id="l2.5"> 2.5</a> <span class="plusline">+b
326 </span></pre></div>
327 </div>
328
329 </div>
330 </div>
331
332
333 </body>
334 </html>
335
336
337 revision
338
339 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-rev/0'
340 200 Script output follows
341
342
343 # HG changeset patch
344 # User test
345 # Date 0 0
346 # Node ID 0cd96de13884b090099512d4794ae87ad067ea8e
347
348 a
349
350 diff --git a/a b/a
351 new file mode 100644
352 --- /dev/null
353 +++ b/a
354 @@ -0,0 +1,1 @@
355 +a
356 diff --git a/b b/b
357 new file mode 100644
358 --- /dev/null
359 +++ b/b
360 @@ -0,0 +1,1 @@
361 +b
362
363
364 diff removed file
365
366 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a'
367 200 Script output follows
368
369 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
370 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
371 <head>
372 <link rel="icon" href="/static/hgicon.png" type="image/png" />
373 <meta name="robots" content="index, nofollow" />
374 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
375
376 <title>test: a diff</title>
377 </head>
378 <body>
379
380 <div class="container">
381 <div class="menu">
382 <div class="logo">
383 <a href="http://mercurial.selenic.com/">
384 <img src="/static/hglogo.png" alt="mercurial" /></a>
385 </div>
386 <ul>
387 <li><a href="/shortlog/78e4ebad7cdf">log</a></li>
388 <li><a href="/graph/78e4ebad7cdf">graph</a></li>
389 <li><a href="/tags">tags</a></li>
390 <li><a href="/branches">branches</a></li>
391 </ul>
392 <ul>
393 <li><a href="/rev/78e4ebad7cdf">changeset</a></li>
394 <li><a href="/file/78e4ebad7cdf">browse</a></li>
395 </ul>
396 <ul>
397 <li><a href="/file/78e4ebad7cdf/a">file</a></li>
398 <li><a href="/file/tip/a">latest</a></li>
399 <li class="active">diff</li>
400 <li><a href="/annotate/78e4ebad7cdf/a">annotate</a></li>
401 <li><a href="/log/78e4ebad7cdf/a">file log</a></li>
402 <li><a href="/raw-file/78e4ebad7cdf/a">raw</a></li>
403 </ul>
404 </div>
405
406 <div class="main">
407 <h2><a href="/">test</a></h2>
408 <h3>diff a @ 1:78e4ebad7cdf</h3>
409
410 <form class="search" action="/log">
411 <p></p>
412 <p><input name="rev" id="search1" type="text" size="30" /></p>
413 <div id="hint">find changesets by author, revision,
414 files, or words in the commit message</div>
415 </form>
416
417 <div class="description">b</div>
418
419 <table id="changesetEntry">
420 <tr>
421 <th>author</th>
422 <td>&#116;&#101;&#115;&#116;</td>
423 </tr>
424 <tr>
425 <th>date</th>
426 <td>Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
427 </tr>
428 <tr>
429 <th>parents</th>
430 <td></td>
431 </tr>
432 <tr>
433 <th>children</th>
434 <td></td>
435 </tr>
436
437 </table>
438
439 <div class="overflow">
440 <div class="sourcefirst"> line diff</div>
441
442 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> new file mode 100755
443 <a href="#l1.2" id="l1.2"> 1.2</a> <span class="minusline">--- /dev/null
444 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="plusline">+++ b/a
445 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="atline">@@ -0,0 +1,1 @@
446 </span><a href="#l1.5" id="l1.5"> 1.5</a> <span class="plusline">+a
447 </span></pre></div>
448 </div>
449 </div>
450 </div>
451
452
453
454 </body>
455 </html>
456
457 $ cd ..
458
459 test import rev as raw-rev
460
461 $ hg clone -r0 test test1
462 requesting all changes
463 adding changesets
464 adding manifests
465 adding file changes
466 added 1 changesets with 2 changes to 2 files
467 updating to branch default
468 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
469 $ cd test1
470 $ hg import -q --exact http://localhost:$HGPORT/rev/1
471
472 errors
473
474 $ cat ../test/errors.log