changeset 14562:fccd3b966da7

web: provide the file number to the diffstat templates This allows the diffstat templates to link into the diff output. For example, the URLs of the first three files within the diff are #l1.1, #l2.1, #l3.1.
author Steven Brown <StevenGBrown@gmail.com>
date Thu, 09 Jun 2011 01:15:49 +0800
parents 925d9f2b188b
children 81fc9678b018
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Thu Jun 09 01:14:22 2011 +0800
+++ b/mercurial/hgweb/webutil.py	Thu Jun 09 01:15:49 2011 +0800
@@ -223,10 +223,12 @@
             return 0
         return (float(i) / maxtotal) * 100
 
+    fileno = 0
     for filename, adds, removes, isbinary in stats:
         template = filename in files and 'diffstatlink' or 'diffstatnolink'
         total = adds + removes
-        yield tmpl(template, node=ctx.hex(), file=filename,
+        fileno += 1
+        yield tmpl(template, node=ctx.hex(), file=filename, fileno=fileno,
                    total=total, addpct=pct(adds), removepct=pct(removes),
                    parity=parity.next())