Mercurial > hg
comparison mercurial/templates/gitweb/map @ 17202:1ae119269ddc
hgweb: side-by-side comparison functionality
Adds new web command to the core, ``comparison``, which enables colorful
side-by-side change display, which for some might be much easier to work with
than the standard line diff output. The idea how to implement comes from the
SonicHq extension.
The web interface gets a new link to call the comparison functionality. It lets
users configure the amount of context lines around change blocks, or to show
full files - check help (also in this changeset) for details and defaults. The
setting in hgrc can be overridden by adding ``context=<value>`` to the request
query string. The comparison creates addressable lines, so as to enable sharing
links to specific lines, just as standard diff does.
Incorporates updates to all web related styles.
Known limitations:
* the column diff is done against the first parent, just as the standard diff
* this change allows examining diffs for single files only (as I am not sure if
examining the whole changeset in this way would be helpful)
* syntax highlighting of the output changes is not performed (enabling the
highlight extension has no influence on it)
author | wujek srujek |
---|---|
date | Sun, 08 Jul 2012 17:17:02 +0200 |
parents | fe9d36a6853e |
children | 5c64ce6168da |
comparison
equal
deleted
inserted
replaced
17201:afd75476939e | 17202:1ae119269ddc |
---|---|
24 <td></td> | 24 <td></td> |
25 <td class="link"> | 25 <td class="link"> |
26 <a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> | | 26 <a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> | |
27 <a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> | | 27 <a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> | |
28 <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | | 28 <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | |
29 <a href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | | |
29 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> | 30 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> |
30 </td> | 31 </td> |
31 </tr>' | 32 </tr>' |
32 filenolink = ' | 33 filenolink = ' |
33 <tr class="parity{parity}"> | 34 <tr class="parity{parity}"> |
35 <td></td> | 36 <td></td> |
36 <td class="link"> | 37 <td class="link"> |
37 file | | 38 file | |
38 annotate | | 39 annotate | |
39 <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | | 40 <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | |
41 <a href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | | |
40 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> | 42 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> |
41 </td> | 43 </td> |
42 </tr>' | 44 </tr>' |
43 | 45 |
44 nav = '{before%naventry} {after%naventry}' | 46 nav = '{before%naventry} {after%naventry}' |
79 </td> | 81 </td> |
80 </tr>' | 82 </tr>' |
81 filerevision = filerevision.tmpl | 83 filerevision = filerevision.tmpl |
82 fileannotate = fileannotate.tmpl | 84 fileannotate = fileannotate.tmpl |
83 filediff = filediff.tmpl | 85 filediff = filediff.tmpl |
86 filecomparison = filecomparison.tmpl | |
84 filelog = filelog.tmpl | 87 filelog = filelog.tmpl |
85 fileline = ' | 88 fileline = ' |
86 <div style="font-family:monospace" class="parity{parity}"> | 89 <div style="font-family:monospace" class="parity{parity}"> |
87 <pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</pre> | 90 <pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</pre> |
88 </div>' | 91 </div>' |
97 </tr>' | 100 </tr>' |
98 difflineplus = '<span style="color:#008800;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' | 101 difflineplus = '<span style="color:#008800;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' |
99 difflineminus = '<span style="color:#cc0000;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' | 102 difflineminus = '<span style="color:#cc0000;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' |
100 difflineat = '<span style="color:#990099;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' | 103 difflineat = '<span style="color:#990099;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' |
101 diffline = '<span><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' | 104 diffline = '<span><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' |
105 | |
106 comparison = ' | |
107 <table style="border-collapse:collapse;"> | |
108 <thead class="header"> | |
109 <tr> | |
110 <th>{leftrev}:{leftnode|short}</th> | |
111 <th>{rightrev}:{rightnode|short}</th> | |
112 </tr> | |
113 </thead> | |
114 {blocks} | |
115 </table>' | |
116 comparisonblock =' | |
117 <tbody class="block"> | |
118 {lines} | |
119 </tbody>' | |
120 comparisonline = ' | |
121 <tr style="font-family:monospace"> | |
122 <td class="{type}"><pre><a class="linenr" href="#{lineid}" id="{lineid}">{leftlinenumber}</a> {leftline|escape}</pre></td> | |
123 <td class="{type}"><pre><a class="linenr" href="#{lineid}" id="{lineid}">{rightlinenumber}</a> {rightline|escape}</pre></td> | |
124 </tr>' | |
125 | |
102 changelogparent = ' | 126 changelogparent = ' |
103 <tr> | 127 <tr> |
104 <th class="parent">parent {rev}:</th> | 128 <th class="parent">parent {rev}:</th> |
105 <td class="parent"> | 129 <td class="parent"> |
106 <a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a> | 130 <a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a> |
201 <a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}"> | 225 <a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}"> |
202 {node|short} | 226 {node|short} |
203 </a> | 227 </a> |
204 </td> | 228 </td> |
205 </tr>' | 229 </tr>' |
230 filecompparent = ' | |
231 <tr> | |
232 <td>parent {rev}</td> | |
233 <td style="font-family:monospace"> | |
234 <a class="list" href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}"> | |
235 {node|short} | |
236 </a> | |
237 </td> | |
238 </tr>' | |
206 filelogparent = ' | 239 filelogparent = ' |
207 <tr> | 240 <tr> |
208 <td align="right">parent {rev}: </td> | 241 <td align="right">parent {rev}: </td> |
209 <td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td> | 242 <td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td> |
210 </tr>' | 243 </tr>' |
211 filediffchild = ' | 244 filediffchild = ' |
212 <tr> | 245 <tr> |
213 <td>child {rev}</td> | 246 <td>child {rev}</td> |
214 <td style="font-family:monospace"> | 247 <td style="font-family:monospace"> |
215 <a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> | 248 <a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> |
249 </td> | |
250 </tr>' | |
251 filecompchild = ' | |
252 <tr> | |
253 <td>child {rev}</td> | |
254 <td style="font-family:monospace"> | |
255 <a class="list" href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> | |
216 </td> | 256 </td> |
217 </tr>' | 257 </tr>' |
218 filelogchild = ' | 258 filelogchild = ' |
219 <tr> | 259 <tr> |
220 <td align="right">child {rev}: </td> | 260 <td align="right">child {rev}: </td> |