##// END OF EJS Templates
hgweb: cache fctx.parents() in annotate command (issue5414)...
Gregory Szorc -
r30298:4ed8bb8a stable
parent child Browse files
Show More
@@ -861,12 +861,24 b' def annotate(web, req, tmpl):'
861 f = fctx.path()
861 f = fctx.path()
862 parity = paritygen(web.stripecount)
862 parity = paritygen(web.stripecount)
863
863
864 # parents() is called once per line and several lines likely belong to
865 # same revision. So it is worth caching.
866 # TODO there are still redundant operations within basefilectx.parents()
867 # and from the fctx.annotate() call itself that could be cached.
868 parentscache = {}
864 def parents(f):
869 def parents(f):
865 for p in f.parents():
870 rev = f.rev()
866 yield {
871 if rev not in parentscache:
867 "node": p.hex(),
872 parentscache[rev] = []
868 "rev": p.rev(),
873 for p in f.parents():
869 }
874 entry = {
875 'node': p.hex(),
876 'rev': p.rev(),
877 }
878 parentscache[rev].append(entry)
879
880 for p in parentscache[rev]:
881 yield p
870
882
871 def annotate(**map):
883 def annotate(**map):
872 if util.binary(fctx.data()):
884 if util.binary(fctx.data()):
General Comments 0
You need to be logged in to leave comments. Login now