Mercurial > public > mercurial-scm > hg-stable
diff tests/test-tag.t @ 26485:43bf9471fae9
templater: introduce {latesttag()} function to match a pattern (issue4184)
This allows the latest class of tag to be found, such as a release candidate or
final build, instead of just the absolute latest.
It doesn't appear that the existing keyword can be given an optional argument.
There is a keyword, function and filter for 'date', so it doesn't seem harmful
to introduce a new function with the same name as an existing keyword. Most
functions are pretty Mercurial agnostic, but there is {revset()} as precedent.
Even though templatekw.getlatesttags() returns a single tuple, one entry of
which is a list, it is simplest to present this as a list of tags instead of a
single item, with each tag having a distance and change count attribute. It is
also closer to how {latesttag} returns a list of tags, and how this function
works when not given a '%' operator.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 23 Aug 2015 23:44:58 -0400 |
parents | b8245386ab40 |
children | 4414d500604f |
line wrap: on
line diff
--- a/tests/test-tag.t Mon Aug 24 23:07:00 2015 -0400 +++ b/tests/test-tag.t Sun Aug 23 23:44:58 2015 -0400 @@ -461,6 +461,13 @@ $ hg log -r '.' -T "{latesttag % '{latesttag}\n'}" t4 t6 + $ hg log -r '.' -T "{latesttag('t4') % 'T: {tag}, C: {changes}, D: {distance}\n'}" + T: t4, C: 2, D: 2 + $ hg log -r '.' -T "{latesttag('re:\d') % 'T: {tag}, C: {changes}, D: {distance}\n'}" + T: t4, C: 2, D: 2 + T: t6, C: 2, D: 2 + $ hg log -r . -T '{join(latesttag(), "*")}\n' + t4*t6 $ hg ci -A -m4 adding f4 $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n"