Extension:CodeReview

CodeReview extension allows the review of SVN commits on a MediaWiki installation. It adds two new special pages, Special:Code and Special:RepoAdmin. Special:Code is the main CodeReview interface, whereas the RepoAdmin special page is rarely used to create new repositories.

Example
MediaWiki's code review was historically done using this extension on this wiki (MediaWiki.org), at Special:Code/MediaWiki.

MediaWiki was converted from SVN to Git, with Gerrit as the main code review tool, in March 2012. As a direct result of this, the CodeReview extension is no longer maintained by the Wikimedia Foundation and was undeployed from Wikimedia servers in May 2022. The extension is still functional and usable on third-party wikis.

Installation
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   maintenance script in CodeReview's   subdirectory. To run it, type:
 * 8) * If you're getting various host cannot be found and such errors, adjust 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,   or   (on Unix, type   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, in which you'll find the   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  is not available on the server, you should be able to do the same with   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.