##// 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 861 f = fctx.path()
862 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 869 def parents(f):
870 rev = f.rev()
871 if rev not in parentscache:
872 parentscache[rev] = []
865 873 for p in f.parents():
866 yield {
867 "node": p.hex(),
868 "rev": p.rev(),
874 entry = {
875 'node': p.hex(),
876 'rev': p.rev(),
869 877 }
878 parentscache[rev].append(entry)
879
880 for p in parentscache[rev]:
881 yield p
870 882
871 883 def annotate(**map):
872 884 if util.binary(fctx.data()):
General Comments 0
You need to be logged in to leave comments. Login now