Extension:CodeReview
From MediaWiki.org
|
Release status: beta |
|||
|---|---|---|---|
| Implementation | Special page, API | ||
| Description | Code review tool with Subversion support | ||
| Author(s) | Brion Vibber, Aaron Schulz, Alexandre Emsenhuber and Chad Horohoe | ||
| MediaWiki | 1.14a | ||
| License | GNU General Public License 2.0 or later | ||
| Download | Download snapshot |
||
| Example | MediaWiki.org | ||
|
|||
|
|||
|
check usage (experimental) |
|||
CodeReview extension allows to review SVN commits on a MediaWiki installation. It adds two new special pages, Special:Code and Special:RepoAdmin. The former can be accessed by everyone, the latter only by users with the repoadmin user right.
Contents |
[edit] Example
MediaWiki's code review is done using this extension at: Special:Code/MediaWiki
[edit] Installation
Note: These instructions might be missing essential bits and pieces, feel free to improve them.
- Download the files from SVN and place them in $IP/extensions/CodeReview/
- Run codereview.sql against your database with a command like mysql -u [your mysql username here] -p[mysql password here] [database name here] < codereview.sql
- Note: If you have set $wgDBprefix then you will need to manually edit the file to include the correct prefix before running the SQL file, or alternatively rename the tables once done.
- Add
into your wiki's LocalSettings.phprequire_once("$IP/extensions/CodeReview/CodeReview.php");
- Installation can now be verified through your wiki's Special:Version.
To set up a repository:
- You need to be logged in as a user with the
repoadminright (by default this means a user who is a member of thestewardsgroup). - Browse to Special:RepoAdmin
- Enter a repository name into the input box and press "Create" button
- Enter the three required paths; SVN, Bugzilla and ViewVC paths. These paths should be valid URLs, not local paths. For example, http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3 for SVN etc.
- The bugzilla path should be the full URL to display a bug, with $1 representing the bug number (e.g.
http://www.example.com/path/to/bugzilla/show_bug.cgi?id=$1). This path allows bug references in your commit messages to link to the appropriate bug URL.
- The bugzilla path should be the full URL to display a bug, with $1 representing the bug number (e.g.
- Press OK.
- Now the repository has been created and you'll need to import SVN data to it. You can do this with the svnImport.php maintenance script in CodeReview directory. To run it, type: php svnImport.php YourProjectName
- After the import is done, you should be able to review commits through Special:Code/YourProjectName, where YourProjectName is the name of the project you gave in Special:RepoAdmin.
[edit] Automating updates
You can set up your Subversion repository to ping CodeReview through the MediaWiki API on commit, allowing it to stay continuously up to date.
In the repository on your SVN server there's a subdirectory hooks, in which you'll find the post-commit hook file.
Add a line something like this:
# Hit CodeReview wget -q -O /dev/null --post-data="action=codeupdate&format=xml&repo=MyRepoName&rev=$2" \ "http://wiki.example.com/api.php" &
In response to this ping, the CodeReview server will fetch all updates up to the current revision from the SVN repository.
(If wget is not available on the server, you should be able to do the same with curl but a slightly different command line. Note that you must POST the request to the API, and anonymous clients need to have permission to access the wiki and its API.)
[edit] Requirements
A working installation of the command-line SVN client is needed, and the svn PECL extension is recommended.
[edit] User rights
By default, everyone (including anonymous users) can post comments (codereview-post-comment), set the status of a commit (codereview-set-status), add tags (codereview-add-tag) and remove them (codereview-remove-tag).
Only stewards can administrate the SVN repository (repoadmin) and access Special:RepoAdmin.
[edit] See also
This extension is being used on one or more of Wikimedia's wikis. It means that the extension is stable and works well enough to be used by such high traffic websites. A full list of the extensions installed on a particular wiki is produced by Special:Version on that wiki.