Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most recent tag before tip in mercurial

I mark releases with hg tag <version-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.

like image 283
Adam Schmideg Avatar asked Jan 18 '11 16:01

Adam Schmideg


People also ask

What is Mercurial tag?

A tag is a symbolic identifier for a changeset. It can contain any characters except ":" (colon), "\r" (Carriage Return) or "\n" (Line Feed). Mercurial has two kinds of tags: local and regular.

How to remove tag in hg?

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. You'll have to use the -f option to tell Mercurial that you really want to update the tag.

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 does hg update do?

Description. Update the repository's working directory to the specified changeset. If no changeset is specified, update to the tip of the current named branch and move the active bookmark (see hg help bookmarks). Update sets the working directory's parent revision to the specified changeset (see hg help parents).


1 Answers

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.

like image 157
Adam Schmideg Avatar answered Nov 15 '22 11:11

Adam Schmideg