diff tests/test-command-template.t @ 35497:f4aeb952ab77

templater: load template fragments from [templates] section in map file This allows us to %include map-cmdline.<style> file in our .hgrc files. The syntax is slightly different as hgrc doesn't support loading an external template file, but map-cmdline files don't use this feature, so the syntax can be considered identical in practice. Unnamed section is remapped for backward compatibility.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 14 Oct 2017 17:51:01 +0900 (2017-10-14)
parents 3edfd472f3cb
children f17a0e18c47e
line wrap: on
line diff
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -259,6 +259,25 @@
   $ hg log -l1 -T./map-simple
   8
 
+ a map file may have [templates] section:
+
+  $ cat <<'EOF' > map-simple
+  > [templates]
+  > changeset = "{rev}\n"
+  > EOF
+  $ hg log -l1 -T./map-simple
+  8
+
+ so it can be included in hgrc
+
+  $ cat <<'EOF' > myhgrc
+  > %include map-simple
+  > [templates]
+  > foo = "{changeset}"
+  > EOF
+  $ HGRCPATH=./myhgrc hg log -l1 -Tfoo
+  8
+
 Test template map inheritance
 
   $ echo "__base__ = map-cmdline.default" > map-simple