templatekw: add {path} keyword to host documentation
authorYuya Nishihara <yuya@tcha.org>
Sun, 05 Aug 2018 16:33:30 +0900
changeset 39371 3cd977d5a16b
parent 39370 46f3ff64bea7
child 39372 da121c9dc0f2
templatekw: add {path} keyword to host documentation It's hidden since I'm not sure if filectx templates can be a thing. The plan is to add {status}, {size}, etc., which are usable within {files % ...} context.
mercurial/templatekw.py
--- a/mercurial/templatekw.py	Sun Aug 05 16:51:25 2018 +0900
+++ b/mercurial/templatekw.py	Sun Aug 05 16:33:30 2018 +0900
@@ -543,6 +543,12 @@
         return 'obsolete'
     return ''
 
+@templatekeyword('path', requires={'fctx'})
+def showpath(context, mapping):
+    """String. Repository-absolute path of the current file. (EXPERIMENTAL)"""
+    fctx = context.resource(mapping, 'fctx')
+    return fctx.path()
+
 @templatekeyword('peerurls', requires={'repo'})
 def showpeerurls(context, mapping):
     """A dictionary of repository locations defined in the [paths] section