Hg - Find tags that β€œcover” a specific version of a file

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

Now say that I take a specific revision (where I fixed the error, for example). I want to know which releases contain this fix, i.e. Which tags cover this revision.

How to find it? The hg tags seem to only refer to tagged changes. I remember that in ClearCase every ancestor of the marked revision was also marked, is there any way to see this information in hg?

Thanks!

+6
source share
3 answers

Revsets without any additional extensions can give you something. as

hg log -r "id(hash):tip and tag()" or a shorter and more pleasant (maybe) version of hg log -r "descendants(hash) and tag()"

Just an example of a shortened deferral from my repo mergers after the revision

 >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 a comparison of the output of two forms of reverse (the same conclusion in any case)

<strong> 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 
+5
source

This gives a result similar to hg tags :

 hg log -r "reverse(descendants(8bb6)) and tag()" --template "{tags}\t{rev}:{node|short}\n" 
+1
source

You can use the closest extension to find the closest jump tag to your revision. Then, depending on your workflow, you should easily determine which other tag also contains your changes.

You can also use the following to print the last back tag from the current version:

 hg log -l 1 --template "{latesttag}\n" 

And then also display the tag "cover".

0
source

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


All Articles