I'm using SVN with Google Code Proje开发者_JS百科ct Hosting for a school project. As the codebase increases in size, I often find myself wondering questions like:
- "who originally checked in this line of code?"
- "who has been checking in the most code recently?"
- "Of the final product, how much of it was written by Person X?"
- "Which coder is best at adhering to the coding conventions?"
Is there any plugin available to do this? (If not, I would be interested in developing one myself. Any ideas on where to get started on that?)
We're using Visual Studio 2008 with the AnkhSVN plugin.
Within Subversion itself, the command svn blame gives you author and revision information for each line of a file.
The external tool StatSVN is pretty good. It does most of what you want, including author stats. Adherence to code conventions is not covered. For that sort of thing you're better off with something like Sonar.
The svn blame
command gives you the author and revision for the last change for each line, and you can use the -r #
option to look at the same information in an earlier revision. So to get the full history you have to loop:
svn blame -r HEAD
to get the most recent changes.- Check for the line you're interested in to make sure it's present.
- Parse the revision numbers (all in the file or just in the range of lines you're interested in) and find the largest one.
- Back to 1 using the largest revision - 1 instead of
HEAD
.
You'll have trouble keeping track of the line across modifications, in general. I've written some tools that help with each step, but whenever I've needed to do this sort of thing I've had to do it manually, looking at the svn blame output at each stage to see how the code changed in each revision.
精彩评论