changeset 3406:970b2d6de3b3

hgweb: link to file parents in filediff, rather than changeset parents
author Brendan Cully <brendan@kublai.com>
date Sun, 15 Oct 2006 21:20:15 -0700
parents 2e1d8b238b6c
children 03e7e8958a27
files mercurial/hgweb/hgweb_mod.py templates/gitweb/map
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sun Oct 15 20:57:30 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Sun Oct 15 21:20:15 2006 -0700
@@ -553,8 +553,8 @@
     def filediff(self, fctx):
         n = fctx.node()
         path = fctx.path()
-        parents = fctx.changectx().parents()
-        p1 = parents[0].node()
+        parents = fctx.parents()
+        p1 = parents and parents[0].node() or nullid
 
         def diff(**map):
             yield self.diff(p1, n, [path])
--- a/templates/gitweb/map	Sun Oct 15 20:57:30 2006 -0700
+++ b/templates/gitweb/map	Sun Oct 15 21:20:15 2006 -0700
@@ -41,9 +41,9 @@
 diffblock = '<pre>#lines#</pre>'
 changelogtag = '<tr><th class="tag">tag:</th><td class="tag">#tag|escape#</td></tr>'
 changesettag = '<tr><td>tag</td><td>#tag|escape#</td></tr>'
-filediffparent = '<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="{url}rev/#node|short#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
+filediffparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filelogparent = '<tr><td align="right">parent #rev#:&nbsp;</td><td><a href="{url}file/{node|short}/#file|urlescape#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
-filediffchild = '<tr><th class="child">child #rev#:</th><td class="child"><a href="{url}rev/#node|short#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
+filediffchild = '<tr><th class="child">child {rev}:</th><td class="child"><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filelogchild = '<tr><td align="right">child #rev#:&nbsp;</td><td><a href="{url}file{node|short}/#file|urlescape#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
 shortlog = shortlog.tmpl
 shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author#</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> | <a href="{url}file/#node|short#{sessionvars%urlparameter}">manifest</a></td></tr>'