Hot Koehls

The more you know, the more you don’t know

This content is a little crusty, having been with me through 3 separate platform changes. Formatting may be rough, and I am slightly less stupid today than when I wrote it.
20 Jun 2012

Display line numbers in WebSVN file detail view

WebSVN is an open source subversion repository browser written in PHP, offering a compelling alternative to the more obtuse ViewVC and the commercial Atlassian Fisheye.

By default, WebSVN does not display line numbers when looking at the contents of a single file (i.e. URL’s containing filedetails.php). Fortunately, this is easily corrected if you enable Geshi syntax highlighting. It’s enabled by default, but double-check the contents of include/config.php, making sure that the line $config->useGeshi(); is present and not commented out.

$config->useGeshi();

With that done, open include/svnlook.php and go to line 806, which looks like this:

$this->geshi->set_tab_width($this->repConfig->getExpandTabsBy());

Create a new line and insert the following immediately after it:

$this->geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);

Save your changes and reload the file detail view, and Geshi should now display line numbers along the left-hand margin. With this simple change, I use WebSVN to effectively conduct group code reviews.

Note that WebSVN can still choose not to use Geshi if there’s no support for the language in question, in which case there won’t be any line numbers.


comments powered by Disqus