Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is there a tool that takes as input a proposed patch and a git repository, and identifies the developers are the best candidates for reviewing the patch? It would use the git history to identify the authors that have the most experience with the files / sections of code that are being changed.

Edit: The use case is a large open source project (OpenStack Compute), where merge proposals come in, and I see a merge proposal on a chunk of code I'm not familiar with, and I want to add somebody else's name to the list of suggested reviewers so that person gets a notification to look at the merge proposal.

share|improve this question
    
It's bad (totally wrong) idea to suggest ordinary code-monkey as reviewer of code based on file-history –  Lazy Badger Apr 1 '12 at 7:01
1  
@Lazy: Why? Whats wrong with what the OP is looking for, and why is "It's bad (totally wrong)...." ? I see such a tool as being very useful in my workplace. –  mattnz Apr 1 '12 at 7:44
4  
Sorry -difference in ideas of code review purpose - we don't employ "code monkeys". In my workplace we are all equals (some may be more equal then others), Code review is used for the purpose of teaching as well as code quality, so all are expected to be reviewers, and all expected to be reviewed. –  mattnz Apr 1 '12 at 21:36
1  
How do you want to quantify "most experience"? Most lines of code? Most recent edits? If I wrote an entire file/module a year ago and haven't touched it sense, and someone else made a few minor changes last week, who is suitable? I'm not sure how you can automatically determine the best candidates with any reasonable amount of certainty... –  Thomas Owens Apr 4 '12 at 15:25
1  
@ThomasOwens I added more details to the question. –  Lorin Hochstein Apr 5 '12 at 13:20
show 3 more comments

1 Answer

I'm not aware of any such tool, but a baseline one is easy enough to write:

(for file in $files_touched_by_patch; do
    git blame -p "$file"
done) \
  | grep '^author ' | sed 's/^author *//' \
  | sort | uniq -c | sort -nrk 1

will list the people who last touched $files_touched_by_patch, sorted by how many of their lines of code survive in the current version.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.