How to list all tags in a specific Mercurial branch?

Is it possible to list tags only on a specific branch? (preferably from the command line)

For instance:

$ hg branch test1 ... (make some commits) $ hg tag mytag_on_test1_branch $ hg branch test2 ... (make some commits) $ hg tag mytag_on_test2_branch ... (make some commits) $ hg tag mytag_on_test2_branch_2 

Now hg tags returns:

 $ hg tags tip 5:34603c3a4107 mytag_on_test2_branch_2 4:72db17d2170c mytag_on_test2_branch 2:09aed50d8b95 mytag_on_test1_branch 0:d43c48c0e1d8 

I would only like to see tags on the "test2" branch, for example:

 mytag_on_test2_branch_2 4:72db17d2170c mytag_on_test2_branch 2:09aed50d8b95 

Is it possible?

+6
source share
1 answer

How often, the answer lies in the correct use of reverse; they are a powerful tool for limiting audit ranges to almost any need. See hg help revsets .

In your case, we also use output templates to show only tags, and not the full output of the log of these changes. Thus, if you need all the tags for THISBRANCH:

 hg log --rev="branch(THISBRANCH) and tag()" --template="{tags}\n" 

Output example for a widely tagged repo

 hgsubversion>hg log -r "branch(stable) and tag()" -T "{tags}\n" 1.5.1 1.6.1 1.6.2 1.6.3 1.7 1.8 1.8.1 1.8.2 
+8
source

All Articles