Lincoln
Lincoln

Reputation: 1108

How to find the latest tag matching a specific pattern in Mercurial (Hg)

I know how to do this in git for the glob-style tag pattern ros/* with:

git describe --abbrev=0 --tags --match 'ros/*'

What is the equivalent hg command?

I know I can get the latest tag with either of the following command:

hg log --rev . --template {latesttag}

Upvotes: 1

Views: 192

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97292

You can also use revset for the same result

hg log -r "last(tag('re:ros/.*'))"

Upvotes: 2

Lincoln
Lincoln

Reputation: 1108

The hg latesttag function actually accepts a pattern. So the equivalent command is:

hg log -r . --template "{latesttag(r're:ros/.*')}"

Upvotes: 2

Related Questions