Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In mercurial, how to see tags for only a set of revisions instead of all?

hg tags always shows all tags, so how can I get only the tags that point to a specific revision and all its ancestors?

The real-world use case is that if I use local tags to designate features (or bug fixes) on changesets, and I need to find out the cumulative features/bugs up till a specific rev.

One solution would be adding a wrapper command that adds "-r" to tags. Then what's the best way to implement it? Use revsets to get all ancestral revs and filter the tags?

like image 912
Geoffrey Zheng Avatar asked Feb 26 '23 12:02

Geoffrey Zheng


1 Answers

This should do the trick (requires mercurial 1.7):

hg log -r "ancestors(<rev>) and tag()"

where <rev> is the hash or local revision number. However, tagging every bugfix and feature seems overkill.

Instead of tagging, you can just follow a convention where you put "bugfix: xyz" or "feature: abc" in your commit messages. You can then extract all bugfixes and features like this:

hg log -r "ancestors(<rev>) and (keyword(bugfix) or keyword(feature))"

Keep tags for important milestones or other revisions that have some special significance.

like image 180
Wim Coenen Avatar answered Apr 25 '23 09:04

Wim Coenen