|Version 14 (modified by robguttman, 5 years ago) (diff)|
Lightweight code review of changesets
This plugin comes with its own CommitTicketReferenceMacro which can be optionally used instead of the built-in one to display the current status within the ticket:
When a review summary is provided, it gets added as a comment to all tickets referenced in the changeset (also shown above).
There are other good code review tools out there that I've used (e.g., gerrit) but I wanted something very lightweight that fits well into existing Trac tools and ticket workflow. The few existing Trac-based code review plugins (below) appear to be unmaintained. And so this plugin was born.
- Install the plugin (after downloading and unzipping):
cd codereviewerplugin/0.12 sudo python setup.py bdist_egg sudo cp dist/TracCodeReviewer*.egg /your/trac/location/plugins/
See TracPlugins for more installation details and options. You'll likely need to restart Trac's web server after installation.
- Enable the plugin and if using the built-in commit-updater, disable CommitTicketReferenceMacro:
[components] tracopt.ticket.commit_updater.committicketupdater = enabled tracopt.ticket.commit_updater.committicketreferencemacro = disabled coderev.* = enabled
You can alternatively use the Trac Web Admin GUI to enable or disable components.
- (optional) Customize the names for the three statuses (make sure there are always exactly three in the shown order of meaning):
[codereviewer] status_choices = REJECTED,PENDING,PASSED status_default = PENDING
- After the above, run:
sudo trac-admin /path/to/projenv upgrade
See the examples section below for more configuration options.
If you have any issues, create a new ticket.
Download the zipped source from [download:codereviewerplugin here].
The screenshots in the examples above show basic examples. There are some additional extensions:
There are many ways to integrate code reviews into your Trac ticket workflow. As just one example, you may have a phase custom field that includes different phases:
If you wanted to prevent the phase from moving beyond "codereview" until all pending code reviews were completed and the last changeset passed review, then if using this plugin's commit ticket reference macro you can add the following DynamicFields plugin rules:
[ticket-custom] phase.invalid_if.1 = verifying phase.invalid_when.1 = .codereviewstatus .pending (msg:Pending code reviews.) phase.invalid_if.2 = verifying phase.invalid_when.2 = .codereviewstatus:last .rejected (msg:The last code review did not pass.)
- 15743 by rjollos on 2016-09-02 02:51:04
1.0.0dev: Account for data being None for some requests
Addendum to r15732.
- 15732 by rjollos on 2016-08-28 01:49:22
1.0.0dev: Don't add code reviewer when viewing a diff
- 14888 by rjollos on 2015-08-22 23:41:34
1.0.0dev: Redirect didn't account for base URL. Fixes #12474.
Unsupported operands error with repository containing integer revisions. Refs trac:#12179.
Both patches by Jun Omae.