开发者

HG: Checkout 'tipmost' tag

开发者 https://www.devze.com 2023-04-09 02:20 出处:网络
In mercurial, is there an easy way to programmatically check out the \'latest\' tag? Meaning, if hg tags produces this:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号