# HG changeset patch # User Yuya Nishihara # Date 1521276067 -32400 # Node ID 7db3c28dfdfd7c86d4847ca003cd36bebb2c1dbc # Parent be3f33f5e232512a8b128720579feda239191376 formatter: port handling of 'originalnode' to populatemap() hook This isn't a pure templating business, so let's move out of the templater module. Note that this works only in web templates where mapping['node'] is a static value. diff -r be3f33f5e232 -r 7db3c28dfdfd mercurial/formatter.py --- a/mercurial/formatter.py Thu Mar 15 21:52:47 2018 +0900 +++ b/mercurial/formatter.py Sat Mar 17 17:41:07 2018 +0900 @@ -514,6 +514,8 @@ mapping = {} if self._hasctx(newmapping): mapping['revcache'] = {} # per-ctx cache + if 'node' in origmapping and 'node' in newmapping: + mapping['originalnode'] = origmapping['node'] return mapping def _getsome(self, context, mapping, key): diff -r be3f33f5e232 -r 7db3c28dfdfd mercurial/templateutil.py --- a/mercurial/templateutil.py Thu Mar 15 21:52:47 2018 +0900 +++ b/mercurial/templateutil.py Sat Mar 17 17:41:07 2018 +0900 @@ -406,7 +406,6 @@ if isinstance(v, dict): lm = context.overlaymap(mapping, v) lm['index'] = i - lm['originalnode'] = mapping.get('node') yield evalrawexp(context, lm, targ) else: # v is not an iterable of dicts, this happen when 'key'