Mercurial > hg
comparison mercurial/hgweb/webcommands.py @ 29388:f694e20193f2
hgweb: display blamed revision once per block in annotate view
I.e. when a revision blames a block of source lines, only display the
revision link on the first line of the block (this is identified by the
"blockhead" key in annotate context).
This addresses item "Visual grouping of changesets" of the blame improvements
plan (https://www.mercurial-scm.org/wiki/BlamePlan) which states: "Typically
there are block of lines all attributed to the same revision. Instead of
rendering the revision/changeset for every line, we could only render it once
per block."
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Tue, 07 Jun 2016 12:10:01 +0200 |
parents | e4b777fe1576 |
children | c4fc33c477da |
comparison
equal
deleted
inserted
replaced
29387:6b77adc2c7b5 | 29388:f694e20193f2 |
---|---|
870 lines = enumerate([((fctx.filectx(fctx.filerev()), 1), | 870 lines = enumerate([((fctx.filectx(fctx.filerev()), 1), |
871 '(binary:%s)' % mt)]) | 871 '(binary:%s)' % mt)]) |
872 else: | 872 else: |
873 lines = enumerate(fctx.annotate(follow=True, linenumber=True, | 873 lines = enumerate(fctx.annotate(follow=True, linenumber=True, |
874 diffopts=diffopts)) | 874 diffopts=diffopts)) |
875 previousrev = None | |
875 for lineno, ((f, targetline), l) in lines: | 876 for lineno, ((f, targetline), l) in lines: |
877 rev = f.rev() | |
878 blockhead = rev != previousrev or None | |
879 previousrev = rev | |
876 yield {"parity": next(parity), | 880 yield {"parity": next(parity), |
877 "node": f.hex(), | 881 "node": f.hex(), |
878 "rev": f.rev(), | 882 "rev": rev, |
879 "author": f.user(), | 883 "author": f.user(), |
880 "desc": f.description(), | 884 "desc": f.description(), |
881 "extra": f.extra(), | 885 "extra": f.extra(), |
882 "file": f.path(), | 886 "file": f.path(), |
887 "blockhead": blockhead, | |
883 "targetline": targetline, | 888 "targetline": targetline, |
884 "line": l, | 889 "line": l, |
885 "lineno": lineno + 1, | 890 "lineno": lineno + 1, |
886 "lineid": "l%d" % (lineno + 1), | 891 "lineid": "l%d" % (lineno + 1), |
887 "linenumber": "% 6d" % (lineno + 1), | 892 "linenumber": "% 6d" % (lineno + 1), |