Mercurial > hg
comparison tests/test-template-keywords.t @ 41728:36b62a522814
templatekw: make negrev return empty for wdir() and nullrev
I considered just returning the same output that {rev} returns here,
but {rev} also returns essentially gibberish: either an INT_MAX-kind
of variable for wdir() or -1 for null. Since these are numbers that
are intended to be used for calculations, and since the numbers for
wdir() and -1 are not really very helpful for calculation (and worse,
when used as a revision number -1 is equal to unhidden tip), I figured
the most reasonable thing to do here is to just return nothing for
negrev.
This could potentially break scripts that are expecting to parse a
nonempty integer out of a {negrev}, but that seems like a very remote
concern at this juncture.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Mon, 18 Feb 2019 23:43:40 -0500 |
parents | 66102f6fa10a |
children | 7a64ad3f325d |
comparison
equal
deleted
inserted
replaced
41727:e1643a0455c8 | 41728:36b62a522814 |
---|---|
73 } | 73 } |
74 ] | 74 ] |
75 | 75 |
76 $ hg log -r 'wdir()' -T '{manifest}\n' | 76 $ hg log -r 'wdir()' -T '{manifest}\n' |
77 2147483647:ffffffffffff | 77 2147483647:ffffffffffff |
78 | |
79 However, for negrev, we refuse to output anything (as well as for null) | |
80 | |
81 $ hg log -r 'wdir() + null' -T 'bla{negrev}nk\n' | |
82 blank | |
83 blank | |
78 | 84 |
79 Changectx-derived keywords are disabled within {manifest} as {node} changes: | 85 Changectx-derived keywords are disabled within {manifest} as {node} changes: |
80 | 86 |
81 $ hg log -r0 -T 'outer:{p1node} {manifest % "inner:{p1node}"}\n' | 87 $ hg log -r0 -T 'outer:{p1node} {manifest % "inner:{p1node}"}\n' |
82 outer:0000000000000000000000000000000000000000 inner: | 88 outer:0000000000000000000000000000000000000000 inner: |