mercurial/templater.py
changeset 26485 43bf9471fae9
parent 26334 0a5a774f5956
child 26504 875e5d89dc86
--- a/mercurial/templater.py	Mon Aug 24 23:07:00 2015 -0400
+++ b/mercurial/templater.py	Sun Aug 23 23:44:58 2015 -0400
@@ -512,6 +512,19 @@
     # ignore args[0] (the label string) since this is supposed to be a a no-op
     yield args[1][0](context, mapping, args[1][1])
 
+def latesttag(context, mapping, args):
+    """:latesttag([pattern]): The global tags matching the given pattern on the
+    most recent globally tagged ancestor of this changeset."""
+    if len(args) > 1:
+        # i18n: "latesttag" is a keyword
+        raise error.ParseError(_("latesttag expects at most one argument"))
+
+    pattern = None
+    if len(args) == 1:
+        pattern = stringify(args[0][0](context, mapping, args[0][1]))
+
+    return templatekw.showlatesttags(pattern, **mapping)
+
 def localdate(context, mapping, args):
     """:localdate(date[, tz]): Converts a date to the specified timezone.
     The default is local date."""
@@ -733,6 +746,7 @@
     "indent": indent,
     "join": join,
     "label": label,
+    "latesttag": latesttag,
     "localdate": localdate,
     "pad": pad,
     "revset": revset,