HG: Checkout 'tipmost' tag

In mercurial, is there an easy way to programmatically check the "last" tag?

The value if hg tags produces the following:

 tip Tag3 Tag2 Tag1 

Is there an easy way to check tag 3 in general? The value is not only a hg checkout Tag3 , but also a general way to do this.

EDIT: If I have to use scripts, I can. However, I am stuck on windows and would like to avoid scripting if possible.

+7
source share
2 answers

You can do this with revsets . Maybe something like this:

 hg update -r 'max(tagged())' 
+15
source

If you are using bash:

 hg checkout $(hg tags | sed -n '2p') 

Note that this gets worse gracefully: if there are no tags, the subcommand will return an empty value and you will get a simple hint check.

+2
source

All Articles