Extension:CodeReview

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.

Example
MediaWiki's code review is done using this extension at: Special:Code/MediaWiki

Installation
These instructions might be missing essential bits and pieces, feel free to improve them.
 * 1) Download the files from SVN and place them in $IP/extensions/CodeReview/
 * 2) Add  into your wiki's LocalSettings.php
 * 3) Run maintenance/update.php
 * 4) Installation can now be verified through your wiki's Special:Version.

To set up a repository:
 * 1) You need to be logged in as a user with the  right (by default this means a user who is a member of the   group).
 * 2) Browse to Special:RepoAdmin
 * 3) Enter a repository name into the input box and press "Create" button
 * 4) 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.
 * 5) * The bugzilla path should be the full URL to display a bug, with $1 representing the bug number (e.g. ).  This path allows bug references in your commit messages to link to the appropriate bug URL.
 * 6) Press OK.
 * 7) 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 YourRepoName
 * 8) *If you're getting various host cannot be found and such errors, adjust $wgMaxShellMemory to work around a known problem when shelling out to the 'svn' command (26867) or try installing the PECL svn module
 * 9) *The script is dependent on English messages from the command line SVN client. If your SVN client outputs messages in a different languages, try changing your locale variables such as LANG, LC_ALL or LANGUAGE (on Unix, type locale to see the current values).
 * 10) 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.

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</tt> 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.)

Requirements
A working installation of the command-line SVN client is needed, and the svn PECL extension is recommended.

User rights
By default, everyone (including anonymous users) can post comments (codereview-post-comment</tt>), set the status of a commit (codereview-set-status</tt>), add tags (codereview-add-tag</tt>) and remove them (codereview-remove-tag</tt>).

Only stewards can administrate the SVN repository (repoadmin</tt>) and access Special:RepoAdmin.