comparison mercurial/hgweb/webcommands.py @ 34432:2e32c6a31cc7

annotate: introduce attr for storing per-line annotate data We're going to extend this a bit -- at first by simply adding whether this was a skipped child. We're well on our way to outgrowing tuples, though -- adding more and more fields to tuples becomes annoying very quickly. Differential Revision: https://phab.mercurial-scm.org/D898
author Siddharth Agarwal <sid0@fb.com>
date Mon, 02 Oct 2017 02:34:47 -0700
parents 407ebe7a9b93
children f12de15c5711
comparison
equal deleted inserted replaced
34431:52e9310626a8 34432:2e32c6a31cc7
904 else: 904 else:
905 lines = webutil.annotate(req, fctx, web.repo.ui) 905 lines = webutil.annotate(req, fctx, web.repo.ui)
906 906
907 previousrev = None 907 previousrev = None
908 blockparitygen = paritygen(1) 908 blockparitygen = paritygen(1)
909 for lineno, ((f, targetline), l) in enumerate(lines): 909 for lineno, (aline, l) in enumerate(lines):
910 f = aline.fctx
910 rev = f.rev() 911 rev = f.rev()
911 if rev != previousrev: 912 if rev != previousrev:
912 blockhead = True 913 blockhead = True
913 blockparity = next(blockparitygen) 914 blockparity = next(blockparitygen)
914 else: 915 else:
922 "desc": f.description(), 923 "desc": f.description(),
923 "extra": f.extra(), 924 "extra": f.extra(),
924 "file": f.path(), 925 "file": f.path(),
925 "blockhead": blockhead, 926 "blockhead": blockhead,
926 "blockparity": blockparity, 927 "blockparity": blockparity,
927 "targetline": targetline, 928 "targetline": aline.lineno,
928 "line": l, 929 "line": l,
929 "lineno": lineno + 1, 930 "lineno": lineno + 1,
930 "lineid": "l%d" % (lineno + 1), 931 "lineid": "l%d" % (lineno + 1),
931 "linenumber": "% 6d" % (lineno + 1), 932 "linenumber": "% 6d" % (lineno + 1),
932 "revdate": f.date()} 933 "revdate": f.date()}