Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HG: find where a deleted line was removed

I am looking for the mercurial equivalent of the solution to this question:

How do I "git blame" a deleted line?

In short, I am looking at a mercurial commit where a line was added, and in the current revision this line is no longer present, and I want to find when and why it was removed.

like image 331
undefined Avatar asked May 03 '12 16:05

undefined


2 Answers

hg grep will let you search a change log for a pattern, such as a deleted string. If you are looking for more than just the first occurrence, be sure to include the --all flag. For me it looked something like this:

hg grep --all -r 9876:tip "pattern" path/to/file

Thanks to Anton for the helpful comments and krtek for his related answer.

like image 68
undefined Avatar answered Sep 18 '22 19:09

undefined


hg log -p fileName > fileName.log

Then open the fileName.log file

In there you will find commit the details of each commit along with the diff of that commit. The details of the commit includes the username.

like image 24
Mark Avatar answered Sep 17 '22 19:09

Mark