Most recent tag before tip in mercurial
I mark releases with hg tag <version开发者_如何学Python-number>
. When I release a bugfix, I don't want to increment the version number, but I want to use the most recent version number during the build process. If I run hg tags
, it will show tip
first, then the version numbers in descending order. I can get it running hg tags | head -n2 | tail -n1
. I wonder if there is a more elegant, pure mercurial way to get it.
Well, I'm answering my own question. I found the solution, hg help templates
shows more options than the documentation on the mercurial site. So hg tip --template '{latesttag}\n'
is what I was looking for.
Use the ParentRevSpecExtension: https://www.mercurial-scm.org/wiki/ParentrevspecExtension
It allows you to say tip~1
.
EDIT: Sorry, that doesn't answer the question.
精彩评论