diff mercurial/hgweb/webcommands.py @ 37066:b33b91ca2ec2

annotate: pack line content into annotateline object (API) Just for code readability. We can do that since the annotateline type is no longer used while computing the history.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Mar 2018 12:28:19 +0900
parents c97b936d8bb5
children f0b6fbea00cf
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Tue Mar 13 22:18:06 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Mar 18 12:28:19 2018 +0900
@@ -945,13 +945,14 @@
         if fctx.isbinary():
             mt = (mimetypes.guess_type(fctx.path())[0]
                   or 'application/octet-stream')
-            lines = [((fctx.filectx(fctx.filerev()), 1), '(binary:%s)' % mt)]
+            lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()),
+                                        lineno=1, text='(binary:%s)' % mt)]
         else:
             lines = webutil.annotate(web.req, fctx, web.repo.ui)
 
         previousrev = None
         blockparitygen = paritygen(1)
-        for lineno, (aline, l) in enumerate(lines):
+        for lineno, aline in enumerate(lines):
             f = aline.fctx
             rev = f.rev()
             if rev != previousrev:
@@ -971,7 +972,7 @@
                    "blockhead": blockhead,
                    "blockparity": blockparity,
                    "targetline": aline.lineno,
-                   "line": l,
+                   "line": aline.text,
                    "lineno": lineno + 1,
                    "lineid": "l%d" % (lineno + 1),
                    "linenumber": "% 6d" % (lineno + 1),