[PATCH 5 of 8] hgweb: wrap {parents} of {annotate} with mappinggenerator
Yuya Nishihara
yuya at tcha.org
Mon May 21 08:22:42 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1522841398 -32400
# Wed Apr 04 20:29:58 2018 +0900
# Node ID e58591b37eada3d982d2db29901c73e8b084c4f9
# Parent 6970d3a9c6a4ee333a1a10abccfa40a8771af471
hgweb: wrap {parents} of {annotate} with mappinggenerator
It's a generator of at most two mappings, which has to be wrapped.
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -929,7 +929,7 @@ def annotate(web):
# TODO there are still redundant operations within basefilectx.parents()
# and from the fctx.annotate() call itself that could be cached.
parentscache = {}
- def parents(f):
+ def parents(context, f):
rev = f.rev()
if rev not in parentscache:
parentscache[rev] = []
@@ -967,7 +967,7 @@ def annotate(web):
"node": f.hex(),
"rev": rev,
"author": f.user(),
- "parents": parents(f),
+ "parents": templateutil.mappinggenerator(parents, args=(f,)),
"desc": f.description(),
"extra": f.extra(),
"file": f.path(),
More information about the Mercurial-devel
mailing list