Show More
@@ -0,0 +1,17 b'' | |||||
|
1 | echo % setting up repo | |||
|
2 | hg init test | |||
|
3 | cd test | |||
|
4 | echo a > a | |||
|
5 | hg ci -Ama | |||
|
6 | hg rm a | |||
|
7 | hg ci -mdel | |||
|
8 | ||||
|
9 | echo % set up hgweb | |||
|
10 | hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |||
|
11 | cat hg.pid >> $DAEMON_PIDS | |||
|
12 | ||||
|
13 | echo % revision | |||
|
14 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip' | |||
|
15 | ||||
|
16 | echo % diff removed file | |||
|
17 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' |
@@ -0,0 +1,130 b'' | |||||
|
1 | % setting up repo | |||
|
2 | adding a | |||
|
3 | % set up hgweb | |||
|
4 | % revision | |||
|
5 | 200 Script output follows | |||
|
6 | ||||
|
7 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |||
|
8 | <html> | |||
|
9 | <head> | |||
|
10 | <link rel="icon" href="/static/hgicon.png" type="image/png"> | |||
|
11 | <meta name="robots" content="index, nofollow" /> | |||
|
12 | <link rel="stylesheet" href="/static/style.css" type="text/css" /> | |||
|
13 | ||||
|
14 | <title>test: changeset c78f6c5cbea9</title> | |||
|
15 | </head> | |||
|
16 | <body> | |||
|
17 | ||||
|
18 | <div class="buttons"> | |||
|
19 | <a href="/log/1">changelog</a> | |||
|
20 | <a href="/shortlog/1">shortlog</a> | |||
|
21 | <a href="/graph">graph</a> | |||
|
22 | <a href="/tags">tags</a> | |||
|
23 | <a href="/file/c78f6c5cbea9">files</a> | |||
|
24 | <a href="/raw-rev/c78f6c5cbea9">raw</a> | |||
|
25 | ||||
|
26 | </div> | |||
|
27 | ||||
|
28 | <h2>changeset: del</h2> | |||
|
29 | ||||
|
30 | <table id="changesetEntry"> | |||
|
31 | <tr> | |||
|
32 | <th class="changeset">changeset 1:</th> | |||
|
33 | <td class="changeset"><a href="/rev/c78f6c5cbea9">c78f6c5cbea9</a></td> | |||
|
34 | </tr> | |||
|
35 | <tr><th class="parent">parent 0:</th><td class="parent"><a href="/rev/cb9a9f314b8b">cb9a9f314b8b</a></td></tr> | |||
|
36 | ||||
|
37 | <tr><th class="tag">tag:</th><td class="tag">tip</td></tr> | |||
|
38 | <tr> | |||
|
39 | <th class="author">author:</th> | |||
|
40 | <td class="author">test</td> | |||
|
41 | </tr> | |||
|
42 | <tr> | |||
|
43 | <th class="date">date:</th> | |||
|
44 | <td class="date">Thu Jan 01 00:00:00 1970 +0000 (38 years ago)</td> | |||
|
45 | </tr> | |||
|
46 | <tr> | |||
|
47 | <th class="files">files:</th> | |||
|
48 | <td class="files">a </td> | |||
|
49 | </tr> | |||
|
50 | <tr> | |||
|
51 | <th class="description">description:</th> | |||
|
52 | <td class="description">del</td> | |||
|
53 | </tr> | |||
|
54 | </table> | |||
|
55 | ||||
|
56 | <div id="changesetDiff"> | |||
|
57 | <pre class="parity0"><span class="minusline"><a class="lineno" href="#l1" id="l1"> 1</a>--- a/a Thu Jan 01 00:00:00 1970 +0000 | |||
|
58 | </span><span class="plusline"><a class="lineno" href="#l2" id="l2"> 2</a>+++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
59 | </span><span class="atline"><a class="lineno" href="#l3" id="l3"> 3</a>@@ -1,1 +0,0 @@ | |||
|
60 | </span><span class="minusline"><a class="lineno" href="#l4" id="l4"> 4</a>-a | |||
|
61 | </span></pre> | |||
|
62 | </div> | |||
|
63 | ||||
|
64 | ||||
|
65 | <div class="logo"> | |||
|
66 | <a href="http://www.selenic.com/mercurial/"> | |||
|
67 | <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> | |||
|
68 | </div> | |||
|
69 | ||||
|
70 | </body> | |||
|
71 | </html> | |||
|
72 | ||||
|
73 | ||||
|
74 | ||||
|
75 | % diff removed file | |||
|
76 | 200 Script output follows | |||
|
77 | ||||
|
78 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |||
|
79 | <html> | |||
|
80 | <head> | |||
|
81 | <link rel="icon" href="/static/hgicon.png" type="image/png"> | |||
|
82 | <meta name="robots" content="index, nofollow" /> | |||
|
83 | <link rel="stylesheet" href="/static/style.css" type="text/css" /> | |||
|
84 | ||||
|
85 | <title>test: a diff</title> | |||
|
86 | </head> | |||
|
87 | <body> | |||
|
88 | ||||
|
89 | <div class="buttons"> | |||
|
90 | <a href="/log/1">changelog</a> | |||
|
91 | <a href="/shortlog/1">shortlog</a> | |||
|
92 | <a href="/graph">graph</a> | |||
|
93 | <a href="/tags">tags</a> | |||
|
94 | <a href="/rev/c78f6c5cbea9">changeset</a> | |||
|
95 | <a href="/file/c78f6c5cbea9/a">file</a> | |||
|
96 | <a href="/log/c78f6c5cbea9/a">revisions</a> | |||
|
97 | <a href="/annotate/c78f6c5cbea9/a">annotate</a> | |||
|
98 | <a href="/raw-diff/c78f6c5cbea9/a">raw</a> | |||
|
99 | </div> | |||
|
100 | ||||
|
101 | <h2>a</h2> | |||
|
102 | ||||
|
103 | <table id="filediffEntry"> | |||
|
104 | <tr> | |||
|
105 | <th class="revision">revision 1:</th> | |||
|
106 | <td class="revision"><a href="/rev/c78f6c5cbea9">c78f6c5cbea9</a></td> | |||
|
107 | </tr> | |||
|
108 | <tr><th class="parent">parent 0:</th><td class="parent"><a href="/rev/cb9a9f314b8b">cb9a9f314b8b</a></td></tr> | |||
|
109 | ||||
|
110 | </table> | |||
|
111 | ||||
|
112 | <div id="fileDiff"> | |||
|
113 | <pre class="parity0"><span class="minusline"><a class="lineno" href="#l1" id="l1"> 1</a>--- a/a Thu Jan 01 00:00:00 1970 +0000 | |||
|
114 | </span><span class="plusline"><a class="lineno" href="#l2" id="l2"> 2</a>+++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
115 | </span><span class="atline"><a class="lineno" href="#l3" id="l3"> 3</a>@@ -1,1 +0,0 @@ | |||
|
116 | </span><span class="minusline"><a class="lineno" href="#l4" id="l4"> 4</a>-a | |||
|
117 | </span></pre> | |||
|
118 | </div> | |||
|
119 | ||||
|
120 | ||||
|
121 | <div class="logo"> | |||
|
122 | <a href="http://www.selenic.com/mercurial/"> | |||
|
123 | <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> | |||
|
124 | </div> | |||
|
125 | ||||
|
126 | </body> | |||
|
127 | </html> | |||
|
128 | ||||
|
129 | ||||
|
130 |
@@ -417,24 +417,40 b' def summary(web, req, tmpl):' | |||||
417 | archives=web.archivelist("tip")) |
|
417 | archives=web.archivelist("tip")) | |
418 |
|
418 | |||
419 | def filediff(web, req, tmpl): |
|
419 | def filediff(web, req, tmpl): | |
420 | fctx = webutil.filectx(web.repo, req) |
|
420 | fctx, ctx = None, None | |
421 | n = fctx.node() |
|
421 | try: | |
422 | path = fctx.path() |
|
422 | fctx = webutil.filectx(web.repo, req) | |
423 | parents = fctx.parents() |
|
423 | except LookupError, inst: | |
424 | p1 = parents and parents[0].node() or nullid |
|
424 | ctx = webutil.changectx(web.repo, req) | |
|
425 | path = webutil.cleanpath(web.repo, req.form['file'][0]) | |||
|
426 | if path not in ctx.files(): | |||
|
427 | raise | |||
|
428 | ||||
|
429 | if fctx is not None: | |||
|
430 | n = fctx.node() | |||
|
431 | path = fctx.path() | |||
|
432 | parents = fctx.parents() | |||
|
433 | p1 = parents and parents[0].node() or nullid | |||
|
434 | else: | |||
|
435 | n = ctx.node() | |||
|
436 | # path already defined in except clause | |||
|
437 | parents = ctx.parents() | |||
|
438 | p1 = parents and parents[0].node() or nullid | |||
425 |
|
439 | |||
426 | diffs = web.diff(tmpl, p1, n, [path]) |
|
440 | diffs = web.diff(tmpl, p1, n, [path]) | |
|
441 | rename = fctx and webutil.renamelink(fctx) or [] | |||
|
442 | ctx = fctx and fctx or ctx | |||
427 | return tmpl("filediff", |
|
443 | return tmpl("filediff", | |
428 | file=path, |
|
444 | file=path, | |
429 | node=hex(n), |
|
445 | node=hex(n), | |
430 |
rev= |
|
446 | rev=ctx.rev(), | |
431 |
date= |
|
447 | date=ctx.date(), | |
432 |
desc= |
|
448 | desc=ctx.description(), | |
433 |
author= |
|
449 | author=ctx.user(), | |
434 |
rename= |
|
450 | rename=rename, | |
435 |
branch=webutil.nodebranchnodefault( |
|
451 | branch=webutil.nodebranchnodefault(ctx), | |
436 | parent=webutil.siblings(parents), |
|
452 | parent=webutil.siblings(parents), | |
437 |
child=webutil.siblings( |
|
453 | child=webutil.siblings(ctx.children()), | |
438 | diff=diffs) |
|
454 | diff=diffs) | |
439 |
|
455 | |||
440 | diff = filediff |
|
456 | diff = filediff |
General Comments 0
You need to be logged in to leave comments.
Login now