Created 27 November 2007
One thing I’ve missed from Perforce since using Subversion is the “p4 annotate -a” command. This annotates a file with the revisions that introduced each line, much like the “svn blame” command. But the -a switch tells it to include every revision of every line. This is a way of getting the complete history of the file in one textual output. It’s great for finding a snippet that you suspect existed somewhere in the file’s past.
Blameall.py provides the same feature, but for Subversion.
For example, let’s say you have a file with a number of revisions. Revision 26:
- Ice Cream
Running blameall shows the history of the file in one series of lines:
$ python blameall.py shoplist.txt
26 27 28
26 head Shopping List
26 27 - Milk
26 26 - Bread
27 head - Juice
26 26 - Eggs
28 head - Cereal
28 head - Ice Cream
This shows us that “Milk” appeared in revision 26 and was present through revision 27. “Shopping List” appeared in 26, and is still in the file in the head revision.
It can be slow to get all the revisions, but it’s faster than manually searching through old revisions for that piece you know was back there somewhere.
You can provide a -r argument to blameall to limit its attention to a particular range of revisions.
Blameall is a single-file Python script, no need to install anything. Just download and run:Download: blameall.py