Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/webcommands.py @ 29572:d86b54d9bb0c
paper: make different blocks of annotated lines have different colors
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 16 Jul 2016 14:49:07 +0800 |
parents | df7d8ea90695 |
children | dd0ff715a82c |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Fri May 20 09:47:35 2016 +0900 +++ b/mercurial/hgweb/webcommands.py Sat Jul 16 14:49:07 2016 +0800 @@ -880,9 +880,14 @@ lines = fctx.annotate(follow=True, linenumber=True, diffopts=diffopts) previousrev = None + blockparitygen = paritygen(1) for lineno, ((f, targetline), l) in enumerate(lines): rev = f.rev() - blockhead = rev != previousrev or None + if rev != previousrev: + blockhead = True + blockparity = next(blockparitygen) + else: + blockhead = None previousrev = rev yield {"parity": next(parity), "node": f.hex(), @@ -893,6 +898,7 @@ "extra": f.extra(), "file": f.path(), "blockhead": blockhead, + "blockparity": blockparity, "targetline": targetline, "line": l, "lineno": lineno + 1,