templater: make it clearer that parsing doesn't cause recursion
Only compileexp() may recurse into _load().
--- a/mercurial/templater.py Thu May 03 10:53:29 2018 +0900
+++ b/mercurial/templater.py Thu May 03 11:09:27 2018 +0900
@@ -665,12 +665,12 @@
def _load(self, t):
'''load, parse, and cache a template'''
if t not in self._cache:
+ x = parse(self._loader(t))
+ if self._aliasmap:
+ x = _aliasrules.expand(self._aliasmap, x)
# put poison to cut recursion while compiling 't'
self._cache[t] = (_runrecursivesymbol, t)
try:
- x = parse(self._loader(t))
- if self._aliasmap:
- x = _aliasrules.expand(self._aliasmap, x)
self._cache[t] = compileexp(x, self, methods)
except: # re-raises
del self._cache[t]