Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hg - Find tags that "cover" specific file version

Tags:

mercurial

tags

We use hg to control the sources for a large project. Whenever we do a release, we tag the version in hg.

Now say I take a specific revision (where I've fixed a bug for example). I want to know which releases contain this fix, i.e. which tags "cover" this revision.

How do I find this? In hg tags seem to refer only to the tagged changeset. I remember that in ClearCase every ancestor of the tagged revision would be marked too, is there a way to see this information in hg?

Thanks!

like image 761
YMA Avatar asked Jan 02 '12 17:01

YMA


2 Answers

Revsets without any additional extensions can give you something. like

hg log -r "id(hash):tip and tag()" or shorter and nicer (maybe) version hg log -r "descendants(hash) and tag()"

Just and example of shortened revset from my repo with merges after revision in question

>hg glog -r "descendants(c9e3b41ec78f)"
@  changeset:   65:f202d72d6397
|  tag:         tip
|  parent:      63:c778bae76563
|  user:        Alex Bream
|  date:        Wed Nov 09 21:42:50 2011 +0600
|  summary:     2-9 яюыэюёЄ№■ фю 2769
|
| o  changeset:   64:625d08492555
| |  branch:      Cleanup
| |  parent:      62:eed6619dadb8
| |  user:        Alex Bream
| |  date:        Wed Nov 09 21:38:44 2011 +0600
| |  summary:     ╟рўшёЄър яю 1-1 155
| |
o |  changeset:   63:c778bae76563
|\|  parent:      61:e7ae9e5f725a
| |  parent:      62:eed6619dadb8
| |  user:        Alex Bream
| |  date:        Wed Nov 09 21:33:22 2011 +0600
| |  summary:     Merge with Cleanup
| |
| o  changeset:   62:eed6619dadb8
| |  branch:      Cleanup
| |  parent:      59:c9e3b41ec78f
| |  user:        Alex Bream
| |  date:        Thu Mar 03 19:19:34 2011 +0500
| |  summary:     ╟рўшёЄър яю 1-1 131
| |
o |  changeset:   61:e7ae9e5f725a
| |  user:        Alex Bream
| |  date:        Thu Mar 03 05:40:34 2011 +0500
| |  summary:     2-9 яю 2745
| |
o |  changeset:   60:1393fe759096
|\|  parent:      57:a38258cac9b8
| |  parent:      59:c9e3b41ec78f
| |  user:        Alexander
| |  date:        Thu Mar 03 04:59:22 2011 +0500
| |  summary:     Merge ё ўшёЄшыъющ
| |
| o  changeset:   59:c9e3b41ec78f
| |  branch:      Cleanup
| |  user:        Alexander
| |  date:        Thu Mar 03 04:54:11 2011 +0500
| |  summary:     ╟рўшёЄър яЁюыюу яюыэюёЄ№■
| |

And comparing output of two forms of revsets (same output anyway)

descendants()

>hg log -r "descendants(c9e3b41ec78f)" --template "{rev}:{node|short}\n"
59:c9e3b41ec78f
60:1393fe759096
61:e7ae9e5f725a
62:eed6619dadb8
63:c778bae76563
64:625d08492555
65:f202d72d6397

Direct range definition

>hg log -r "id(c9e3b41ec78f):tip" --template "{rev}:{node|short}\n"
59:c9e3b41ec78f
60:1393fe759096
61:e7ae9e5f725a
62:eed6619dadb8
63:c778bae76563
64:625d08492555
65:f202d72d6397
like image 118
Lazy Badger Avatar answered Nov 10 '22 06:11

Lazy Badger


This gives the output similar to hg tags:

hg log -r "reverse(descendants(8bb6)) and tag()" --template "{tags}\t{rev}:{node|short}\n"
like image 25
anatoly techtonik Avatar answered Nov 10 '22 06:11

anatoly techtonik