Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all changesets in named branch where file "X" was modified (including merges) [duplicate]

I am looking for a way with TortoiseHg (or plain hg if no other possibility exists) to locate all the changes to a particular file.

I've tried using a revision set query: merge() and file("path/to/filename.cs") but that didn't get me what I'm looking for. It returns an empty set. I assume this is because merge() only returns merges, and file() only (appears to) returns non-merges, so the intersection is empty.

I've also tried modifies(pattern) but that doesn't appear sufficiently different from file(pattern) (looks to me like file() is the union of adds() and modifies()). contains(pattern) doesn't return any elements at all.

So, is it possible to get a list of changesets in which a particular file has been modified in any way?

like image 715
reidLinden Avatar asked Jul 03 '13 15:07

reidLinden


1 Answers

It looks like you're running into the "how did my change get into this branch" problem. When you merge a changeset into a branch, Mercurial doesn't record that as a change. Instead, it makes a note that the merged changeset is now part of the destination branch. The only time a merge will show that a file was modified is if there was a merge conflict, which results in a new changeset.

Finding what merge brought a changeset into a branch is a two step process. First, you have to find the changeset where the change you're interested in occurred.

 hg log -r "file('<PATTERN>')

Once you have that revision, find the first descendant changeset in the destination branch:

hg log -r "first(branch(<BRANCH>) and descendants(<REVISION>))"
like image 81
Aaron Jensen Avatar answered Oct 13 '22 11:10

Aaron Jensen