Nikolaus Rath's Website

How to find oldest tagged descendant of a given changeset

I occasionally want to know at which version a specific change was first released. Finding the commit that introduced the change is typically easy using hg blame. However, it always takes me several minutes to figure out the correct syntax to figure out the command to find the oldest tagged descendant of this changeset, i.e. (assuming you are tagging releases) the first release that contains the change. Here it is:

hg log -r 'first(sort(descendants(<commit-id>) and tag("re:^release-"), "date"))'