Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HG: Checkout 'tipmost' tag

Tags:

mercurial

tags

In mercurial, is there an easy way to programmatically check out the 'latest' tag?

Meaning, if hg tags produces this:

tip
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.

like image 753
Ben Avatar asked Sep 28 '11 00:09

Ben


People also ask

How do you tag in Mercurial?

You can use "hg tag" command with an option -l or --local. This will store the tag in the file . hg/localtags, which will not be distributed or versioned.

What is hg graft?

hg graft has additional functionality over and above simple cherry picking of one revision. For example, you can graft a range of revisions onto another branch.

What is hg status?

hg status shows the status of a repository. Files are stored in a project's working directory (which users see), and the local repository (where committed snapshots are permanently recorded). hg add tells Mercurial to track files. hg commit creates a snapshot of the changes to 1 or more files in the local repository.

How do you remove a tag on Mercurial?

If you want to remove a tag that you no longer want, use hg tag --remove . You can also modify a tag at any time, so that it identifies a different revision, by simply issuing a new hg tag command.


1 Answers

You can do it with revsets. Probably something like this:

hg update -r 'max(tagged())'
like image 191
Ry4an Brase Avatar answered Oct 13 '22 17:10

Ry4an Brase