Jeff B
Jeff B

Reputation: 8982

Find revision line was removed

I have some code I'm looking through and in the past 50 commits or so, a function I wrote seems to have mysteriously disappeared. I could do a binary search type algorithm done by my slow human hands, but it'd be nice if there was a way I could do a "future-blame" at a specific revision to see when a line changes in the future.

Is there a good way to find when a line is changed/removed in future revisions given an older revision in SVN or Tortoise SVN?

Upvotes: 1

Views: 591

Answers (2)

Dan R.
Dan R.

Reputation: 805

This Python script will do what you want, but I have not had much success with the dependencies. You need to run it on Python 2, not Python 3.

Upvotes: 0

David W.
David W.

Reputation: 107040

I imagine you could do something like this:

for rev {$first_rev..$last_rev}
do
    if svn cat -r$rev $file_name | grep -q $function_name
    then
       echo "Function is in revision $rev"
    fi
done

You could get fancier and use svn log $file_name to get the actual revisions where $file_name was changed. It should be pretty fast.

You can also use svn annotate (aka svn blame and svn praise) which shows you each line in a file, when it was changed, and by who. However, if the function was removed from the file, there's no way to get that from svn annotate.

Upvotes: 1

Related Questions