changeset 39371:3cd977d5a16b

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 16:33:30 +0900
parents 46f3ff64bea7
children da121c9dc0f2
files mercurial/templatekw.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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