Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

If I understand you correctly, you want to:

  • Specify a revision
  • Filter the log to only that changeset + all its ancestors
  • Extract all tags that are in those changesets

You can do that if you can limit yourself to tag names:

hg log -r "ancestors(HASH)" --template "{tags}"
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top