[PATCH 5 of 5] templatekw: add {path} keyword to host documentation
Yuya Nishihara
yuya at tcha.org
Thu Aug 30 09:09:50 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1533454410 -32400
# Sun Aug 05 16:33:30 2018 +0900
# Node ID 28b0bc2ae464037066cb2c329e1f61648d9669d2
# Parent ac97d9eb599ae018b73338cbfa2cd2062221b20d
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.
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -543,6 +543,12 @@ def showobsolete(context, mapping):
return 'obsolete'
return ''
+ at 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
More information about the Mercurial-devel
mailing list