templater: add public interface returning a set of resource keys
authorYuya Nishihara <yuya@tcha.org>
Thu, 15 Mar 2018 21:09:37 +0900
changeset 37501 0f4de9c27973
parent 37500 8bb3899a0f47
child 37502 40c7347f6848
templater: add public interface returning a set of resource keys The next patch depends on knownresourcekeys(), and there's no reason to keep availableresourcekeys() private.
mercurial/templater.py
--- a/mercurial/templater.py	Thu Mar 15 22:27:16 2018 +0900
+++ b/mercurial/templater.py	Thu Mar 15 21:09:37 2018 +0900
@@ -644,6 +644,14 @@
             v = self._defaults.get(key)
         return v
 
+    def availableresourcekeys(self, mapping):
+        """Return a set of available resource keys based on the given mapping"""
+        return self._resources.availablekeys(self, mapping)
+
+    def knownresourcekeys(self):
+        """Return a set of supported resource keys"""
+        return self._resources.knownkeys()
+
     def resource(self, mapping, key):
         """Return internal data (e.g. cache) used for keyword/function
         evaluation"""