changeset 6125:74406f50bd46

Make hgweb annotate link to target line numbers (issue623)
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 15 Feb 2008 21:34:16 +0100
parents b4f86eb13dbd
children 11a09d5779f4
files mercurial/hgweb/hgweb_mod.py templates/gitweb/map templates/map
diffstat 3 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Fri Feb 15 20:06:47 2008 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Feb 15 21:34:16 2008 +0100
@@ -636,7 +636,8 @@
 
         def annotate(**map):
             last = None
-            for lineno, (f, l) in enumerate(fctx.annotate(follow=True)):
+            lines = enumerate(fctx.annotate(follow=True, linenumber=True))
+            for lineno, ((f, targetline), l) in lines:
                 fnode = f.filenode()
                 name = self.repo.ui.shortuser(f.user())
 
@@ -648,6 +649,7 @@
                        "rev": f.rev(),
                        "author": name,
                        "file": f.path(),
+                       "targetline": targetline,
                        "line": l,
                        "lineid": "l%d" % (lineno + 1),
                        "linenumber": "% 6d" % (lineno + 1)}
--- a/templates/gitweb/map	Fri Feb 15 20:06:47 2008 +0100
+++ b/templates/gitweb/map	Fri Feb 15 21:34:16 2008 +0100
@@ -24,7 +24,7 @@
 filediff = filediff.tmpl
 filelog = filelog.tmpl
 fileline = '<div style="font-family:monospace" class="parity#parity#"><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</pre></div>'
-annotateline = '<tr style="font-family:monospace" class="parity#parity#"><td class="linenr" style="text-align: right;"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#author|obfuscate#@#rev#</a></td><td><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a></pre></td><td><pre>#line|escape#</pre></td></tr>'
+annotateline = '<tr style="font-family:monospace" class="parity#parity#"><td class="linenr" style="text-align: right;"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}#l{targetline}">#author|obfuscate#@#rev#</a></td><td><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a></pre></td><td><pre>#line|escape#</pre></td></tr>'
 difflineplus = '<span style="color:#008800;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
 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>'
--- a/templates/map	Fri Feb 15 20:06:47 2008 +0100
+++ b/templates/map	Fri Feb 15 21:34:16 2008 +0100
@@ -24,7 +24,7 @@
 filelog = filelog.tmpl
 fileline = '<div class="parity#parity#"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</div>'
 filelogentry = filelogentry.tmpl
-annotateline = '<tr class="parity#parity#"><td class="annotate"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#author|obfuscate#@#rev#</a></td><td><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a></td><td><pre>#line|escape#</pre></td></tr>'
+annotateline = '<tr class="parity#parity#"><td class="annotate"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}#l{targetline}">#author|obfuscate#@#rev#</a></td><td><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a></td><td><pre>#line|escape#</pre></td></tr>'
 difflineplus = '<span class="plusline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
 difflineminus = '<span class="minusline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
 difflineat = '<span class="atline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'