Clone wiki

svnplot / Home

Introduction

SVNPlot generates graphs similar to StatSVN. The difference is in how the graphs are generated. SVNPlot generates these graphs in two steps. First it converts the Subversion logs into a 'sqlite3' database. Then it uses sql queries to extract the data from the database and then uses excellent Matplotlib plotting library to plot the graphs.

I believe using SQL queries to query the necessary data results in great flexibility in data extraction. Also since the sqlite3 is quite fast, it is possible to generate these graphs on demand.

Installation

Requirements (Third party libraries)

You will need following additional libraries for using SVNPlot

  1. sqlite3 - is default installed with python
  2. pysvn- Python SVN bindings.

If you are going to use Javascript canvas based graphs (svnplot-js.py), then you will need,

  1. JqPlot - Excellent JavaScript canvas based plotting library. It is included in the svnplot installation
  2. D3JS - For creating tag clouds. It is included in the svnplot installation

If you want to use Matplotlib based SVNPlot (svnplot.py), then you will need

  1. NumPy- Matplotlib uses NumPy and SVNPlot uses Matplotlib for plotting.
  2. Matplotlib- You need at least version 0.98.5.2

Installation Steps

Installation instructions for SVNPlot

  1. Download and Install Python 2.7.x or Python 3.5.x version (32 bits)
  2. Install pysvn Extension appropriate for your Python Version
  3. Install NumPy - Not required for Javascript graphs
  4. Install matplotlib Not required for Javascript graphs
  5. Download from Bitbucket. For Windows download Installer exe For other platforms download .zip file (NOTE : Google code has disabled adding new installers. Hence you may have to get the latest code and create the installer.)

For Windows

  1. run the downloaded installer.

For Other platforms:

  1. Unzip SVNPlot-0.7.8.zip to a folder e.g. svnplot_inst
  2. Goto 'svnplot_inst' folder and run setup.py

By default svnplot scripts are installed in Python <site-packages> directory.

NOTE : You have to install the 32 bits version and it must be version 2.7.x, since the 64 bits version is not recognized by the installers for some of the required libraries and version 3.2.x is not supported by some of the required libraries

Quick Start

  • Using SVNPlot is a two step process; first you have to pull data from svn to a SQLite database, then you run the analysis those data.*

Add python <site-packages/svnplot> folder in PATH environment variable or give the full path for executing svnlog2sqlite.py, svnplot.py, svnplotjs.py

1. First generate the sqlite database for your project.

svnlog2sqlite.py [options] <svnrepo url> <sqlitedbpath>

<svnrepo url> can be any repository format supported by Subverson. If you are using the local repositories on windows use the file:/d:/... format.

NOTE : This is URL of repository *root*. For example, updating the SVN graphs for SVNPlot project use http://svnplot.googlecode.com/svn/. Using other urls like http://svnplot.googlecode.com/svn/trunk/ will result in error. (Upto version 0.5.4. This issue is fixed version 0.5.5, now svnrepo_url can be any url inside the repository)

<sqlitedbpath> is sqlite database file path. Its a path on your local machine

Options :

  • -l, --linecount : Update the changed line count data also. By default line count data is NOT updated.
  • _-g, --log_ : enable logging of intermediate data and errors. Enable this option if you face any problems like line count not getting generated, no data in the generated sqlite database etc.
  • -v, --verbose : Verbose output

2. Now generate the graphs. svnplot.py [options] <svnsqlitedbpath> <graphdir> OR svnplot-js.py [options] <svnsqlitedbpath> <output directory>

<graphdir> is local directory on your machine. All the graphs will placed in this directory. For svnplot-js.py, by default necessary jqplot JavaScript files are also copied to this directory.

Following addition options are useful

  • -n '<reponame>', --name=<reponame> : This is name of repository (e.g. project name). It will use in generating the graph titles
  • -s '<searchpath>, --search=<searchpath> : search path in the repository (e.g. _/trunk_)
  • -p '<template file path>', --template=<template file path> : Default svnplot uses its own standard report format. However, you can change report format using -p option.
  • -m, --maxdir <num> : limits the number of directories on the graph to the <num> largest directories as with large numbers of dirs the graph gets blurry.
  • -v, --verbose : verbose output For svnplot-js.py,
  • -j or --copyjs : copy the required excanvas,jQuery and jqPlot JavaScript and css file to output directory

3. Generating Graph with your own report template You can use your own report template for the generated graphs. One example of report template is available in 'svnplot-long.tmpl'. This template directly embed the generated graphs images in the report and doesnot use thumbnails. It is useful to get a printed report.

For example,

svnplot.py -v --dpi 70 -p svnplot-long.tmpl -n "MyRepo" <sqlitedb path> <output directory>

TIP - Use 70 pixesl per inch resolution for better results with svnplot-long.tmpl template.

OR

svnplot-js.py -v -n "MyRepo" <sqlitedb path> <output directory>

IMPORTANT NOTE for migrating from 0.5.x to 0.6

SVNPlot ver 0.6 sqlite database schema is different than 0.5.x schema. Hence for migrating from 0.5.x to 0.6 you will need to regenerate the sqlite database.

Updated