Mercurial > hg
changeset 28177:ab8107c923b4
templater: evaluate each item of revset() as integer revision
Because templater.revset() returns a list of strings, repo["-1"] was mapped to
the tipmost revision. Ideally, we should make revset() return a list of integer
revisions, but it turned out not simple. If revset() is a list of integers,
"{ifcontains(rev, revset(), ...)}" would fail because "ifcontains" casts "rev"
to a string.
So this patch just converts a string back to an integer revision.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 12 Feb 2016 18:08:53 +0900 |
parents | 9ff7261cc0f5 |
children | 96f2d50fb9f6 |
files | mercurial/templatekw.py tests/test-command-template.t |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatekw.py Sat Feb 06 19:16:12 2016 +0900 +++ b/mercurial/templatekw.py Fri Feb 12 18:08:53 2016 +0900 @@ -492,7 +492,7 @@ repo = args['ctx'].repo() f = _showlist(name, revs, **args) return _hybrid(f, revs, - lambda x: {name: x, 'ctx': repo[x], 'revcache': {}}) + lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}}) def showsubrepos(**args): """:subrepos: List of strings. Updated subrepositories in the changeset."""
--- a/tests/test-command-template.t Sat Feb 06 19:16:12 2016 +0900 +++ b/tests/test-command-template.t Fri Feb 12 18:08:53 2016 +0900 @@ -3310,6 +3310,13 @@ 0 a p +a revset item must be evaluated as an integer revision, not an offset from tip + + $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n' + -1:000000000000 + $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n' + -1:000000000000 + Test active bookmark templating $ hg book foo