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

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

In reality, the case is used when I use local tags to indicate functions (or bug fixes) on change sets, and I need to figure out cumulative functions / errors before a certain turn.

One solution would be to add a shell command that adds "-r" to tags . Then what is the best way to implement it? Use revsets to get all ancestors and filter tags?

+4
source share
2 answers

This should do the trick (mercurial 1.7 required):

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

where <rev> is the hash code or local version number. However, marking each patch and feature seems redundant.

Instead of tagging, you can simply follow the convention in which you put "bugfix: xyz" or "feature: abc" in commit messages. Then you can extract all the fixes and functions as follows:

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

Keep tags for important milestones or other changes of particular importance.

+5
source

If you understand correctly, you want:

  • Specify revision
  • Filter the log only for that set of changes + all its ancestors
  • Retrieve all tags that are in these change sets

This can be done if you can limit yourself to tag names:

 hg log -r "ancestors(HASH)" --template "{tags}" 
+3
source

Source: https://habr.com/ru/post/1333229/


All Articles