HG: Checkout 'tipmost' tag
In mercurial, is there an easy way to programmatically check out the 'latest' tag?
Meaning, if hg tags
produces this:
t开发者_开发问答ip
Tag3
Tag2
Tag1
Is there an easy way to checkout Tag 3 in a generic way? Meaning, not just hg checkout Tag3
, but a generic way of doing so.
EDIT: If I must use scripting, I can. However, I'm stuck on windows and would like to avoid scripting if possible.
You can do it with revsets. Probably something like this:
hg update -r 'max(tagged())'
If you're using bash:
hg checkout $(hg tags | sed -n '2p')
Note that this degrades gracefully: if there are no tags the subcommand will return blank and you'll get a simple checkout of the tip.
精彩评论