Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/templates/gitweb/map Fri Jul 06 13:56:40 2012 -0700 +++ b/mercurial/templates/gitweb/map Sun Jul 08 17:17:02 2012 +0200 @@ -26,6 +26,7 @@ <a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> | <a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> | <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | + <a href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> </td> </tr>' @@ -37,6 +38,7 @@ file | annotate | <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | + <a href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> </td> </tr>' @@ -81,6 +83,7 @@ filerevision = filerevision.tmpl fileannotate = fileannotate.tmpl filediff = filediff.tmpl +filecomparison = filecomparison.tmpl filelog = filelog.tmpl fileline = ' <div style="font-family:monospace" class="parity{parity}"> @@ -99,6 +102,27 @@ difflineminus = '<span style="color:#cc0000;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' difflineat = '<span style="color:#990099;"><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' diffline = '<span><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</span>' + +comparison = ' + <table style="border-collapse:collapse;"> + <thead class="header"> + <tr> + <th>{leftrev}:{leftnode|short}</th> + <th>{rightrev}:{rightnode|short}</th> + </tr> + </thead> + {blocks} + </table>' +comparisonblock =' + <tbody class="block"> + {lines} + </tbody>' +comparisonline = ' + <tr style="font-family:monospace"> + <td class="{type}"><pre><a class="linenr" href="#{lineid}" id="{lineid}">{leftlinenumber}</a> {leftline|escape}</pre></td> + <td class="{type}"><pre><a class="linenr" href="#{lineid}" id="{lineid}">{rightlinenumber}</a> {rightline|escape}</pre></td> + </tr>' + changelogparent = ' <tr> <th class="parent">parent {rev}:</th> @@ -203,6 +227,15 @@ </a> </td> </tr>' +filecompparent = ' + <tr> + <td>parent {rev}</td> + <td style="font-family:monospace"> + <a class="list" href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}"> + {node|short} + </a> + </td> + </tr>' filelogparent = ' <tr> <td align="right">parent {rev}: </td> @@ -215,6 +248,13 @@ <a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> </td> </tr>' +filecompchild = ' + <tr> + <td>child {rev}</td> + <td style="font-family:monospace"> + <a class="list" href="{url}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a> + </td> + </tr>' filelogchild = ' <tr> <td align="right">child {rev}: </td>