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

3

6

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?

Amain answered 3/7, 2013 at 15:50 Comment(0)
P
4

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>))"
Paramagnetism answered 4/7, 2013 at 4:5 Comment(1)
thanks much. Sometimes you just can't see the answer. Despite any number of searches, I never came across this one. I appreciate your reply, as well as the link to the duplicate.Amain
G
0

hg log -r "branch(BRANCH) and file('PATTERN')"

Revset also can be used and entered into Filter Tooolbar in THG Workbench

Greensickness answered 3/7, 2013 at 21:35 Comment(0)
B
0
hg log grep name_of_your_file

Does the trick for me in terms of finding all the change sets that have resulted in a change to a given file. Of course if you would like something pretty:

thg log name_of_your_file
Barometrograph answered 4/7, 2013 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.