# HG changeset patch # User Pierre-Yves David # Date 1325845249 -3600 # Node ID a1f818a2b50ddd8e3410cb5e0648536611816d21 # Parent d523b6e7ad2657b6f7c8ac2bbb449bae6ec75808 phases: ``{phase}`` template keyword display the phase name ``{phaseidx}`` is providing the phase index as integer. This integer representation is useful when people need to use the fact that phase are ordered. Test keep using the number version for readability purpose. diff -r d523b6e7ad26 -r a1f818a2b50d mercurial/templatekw.py --- a/mercurial/templatekw.py Thu Dec 29 04:40:09 2011 +0100 +++ b/mercurial/templatekw.py Fri Jan 06 11:20:49 2012 +0100 @@ -276,7 +276,11 @@ return ctx.hex() def showphase(repo, ctx, templ, **args): - """:rev: Integer. The changeset phase.""" + """:rev: String. The changeset phase name.""" + return ctx.phasestr() + +def showphaseidx(repo, ctx, templ, **args): + """:rev: Integer. The changeset phase index.""" return ctx.phase() def showrev(repo, ctx, templ, **args): @@ -317,6 +321,7 @@ 'manifest': showmanifest, 'node': shownode, 'phase': showphase, + 'phaseidx': showphaseidx, 'rev': showrev, 'tags': showtags, } diff -r d523b6e7ad26 -r a1f818a2b50d tests/test-phases-exchange.t --- a/tests/test-phases-exchange.t Thu Dec 29 04:40:09 2011 +0100 +++ b/tests/test-phases-exchange.t Fri Jan 06 11:20:49 2012 +0100 @@ -2,7 +2,7 @@ > [extensions] > graphlog= > EOF - $ alias hgph='hg log --template "{rev} {phase} {desc} - {node|short}\n"' + $ alias hgph='hg log --template "{rev} {phaseidx} {desc} - {node|short}\n"' $ mkcommit() { > echo "$1" > "$1" diff -r d523b6e7ad26 -r a1f818a2b50d tests/test-phases.t --- a/tests/test-phases.t Thu Dec 29 04:40:09 2011 +0100 +++ b/tests/test-phases.t Fri Jan 06 11:20:49 2012 +0100 @@ -1,4 +1,4 @@ - $ alias hglog='hg log --template "{rev} {phase} {desc}\n"' + $ alias hglog='hg log --template "{rev} {phaseidx} {desc}\n"' $ mkcommit() { > echo "$1" > "$1" > hg add "$1"