diff mercurial/formatter.py @ 37078:46859b437697

templater: drop symbols which should be overridden by new 'ctx' (issue5612) This problem is caused by impedance mismatch between the templater and the formatter interface, which is that the template keywords are generally evaluated dynamically, but the formatter puts static values into a template mapping. This patch avoids the problem by removing conflicting values from a mapping dict when a 'ctx' is switched.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 15 Mar 2018 21:38:57 +0900
parents 44757e6dad93
children 638a241202a3
line wrap: on
line diff
--- a/mercurial/formatter.py	Thu Mar 15 21:22:52 2018 +0900
+++ b/mercurial/formatter.py	Thu Mar 15 21:38:57 2018 +0900
@@ -504,6 +504,10 @@
             'ui': ui,
         }
 
+    def availablekeys(self, context, mapping):
+        return {k for k, g in self._gettermap.iteritems()
+                if g(self, context, mapping, k) is not None}
+
     def knownkeys(self):
         return self._knownkeys