Add support for default reviewers
Updated 1 year, 2 months ago
| David Trowbridge | Reviewers | ||
| trunk | reviewboard | ||
| 30 | |||
| None | Review Board SVN | ||
This is a generic solution to the question of adding default reviewers. It's generic enough to be useful both for installations like reviews.r-b.o where there's a single group for all reviews, and the extraordinarily complex case we've got at VMware, where different groups own different parts of a single huge codebase. There's a new model which basically has a regular expression and a list of default people/groups. When a new diff is created, it iterates through the list of filenames in the diff and checks them against each of the DefaultReviewer regexps. If one matches, those defaults are added to the draft's list of target reviewers.
Did a couple tests with different diffs to make sure it added the correct reviewers. This might blow up with diffs that contain added or removed files, I'm not sure. I'll do some more testing with that before I commit.
Posted 1 year, 2 months ago (October 15th, 2007, 2:26 a.m.)
Sweet. With this, we'll be able to add a --publish option to post-review that just lets you fire and forget a review request in most cases.
-
Loading diff fragment...
-
Even if they change, we could do something about that. Keep a dict of regex -> compiled regex mappings and just check if it's in there, then use the compiled one. Though we'd want to purge this on occasion.
Loading diff fragment...
I believe calling self.diffset.files.all() each time will cause a database hit. We can optimize this by storing the queryset outside the first for loop. filediffs = self.diffset.files.all() for default in DefaultReviewer.objecs.all(): for filediff in filediffs: filediffs will contain the cached entries, whereas self.diffset.files.all() should hit the database each time the queryset is recreated. We may want to also compile the regex at the start of the first for loop.