My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Introduction  

Featured, Phase-Deploy
Updated Mar 28, 2010 by nitinbh...@gmail.com

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

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

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

Quick Start

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> OR svnplot-js.py [options] <svnsqlitedbpath> <output directory>
TIP - Use 70 pixesl per inch resolution for better results with svnplot-long.tmpl template.

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.

Comment by eluz...@gmail.com, Nov 3, 2009

Please fix a broken link to "Matplotlib" - from http://matplotlib.sourforge.net/ to http://matplotlib.sourceforge.net/.

Comment by project member nitinbh...@gmail.com, Dec 12, 2009

Matplotlib path corrected. Thanks for pointing it out.

Comment by bryan.ca...@gmail.com, Jul 20, 2010

Sqlite3 may need to be manually installed, if it does the package goes by the name 'pysqlite'

Comment by fly....@gmail.com, Sep 28, 2010

What exactly is the motication for this project? is it different from svnstat? if so how?

Comment by olle.jonsson, Dec 14, 2010

Motivations for this project can be read in the Why Svnplot article.

Comment by hamacher...@gmail.com, Mar 24, 2011

You should specify a step by step guide for using this product on Windows. I ran the installer. Now what? C:\Users\Jacob>python svnlog2sqlite.py python: can't open file 'svnlog2sqlite.py': 2? No such file or directory

Comment by gray...@gmail.com, May 12, 2011

I may have to politely agree with the previous poster about having instructions on how to use this. Also, it would be cool if there were demos or screenshots on what this tool does. Maybe there is, and I'm not just finding it. If that's the case, then it should very easy to get this. Also, I don't get a warm and fuzzy feeling with pointing a script at our repository's root. What exactly is svnlog2sqlite doing? How do I know it's not modifying our repository? (maybe it is, i don't know). Anyway, that's my 2 cents. Keep up the good work!

Comment by lord.nig...@gmail.com, Jun 17, 2011

@gray: you can be certain it won't modify your repository by having it connect over the network, and authenticating itself as a user with read-only access.

Alternatively, you can read the source. Or you could see what a Google search turns up.

Comment by seb...@gmail.com, Jun 29, 2011

It doesn't say so on this page nor in the usage message but you can provide a start and stop date.

svnlog2sqlite.py options? <svnrepo url> <sqlitedbpath> stopdate?

Both dates have to be provided and must be in the format 'year-month-day'. The year can be two or four digits and the whole thing may be enclosed in {} like an SVN date.

Useful if you have a large repository.

Comment by migaldenis, Oct 27, 2011

Very usefull It will be nice if user can specify some params by args like date range for drawing stats or determine author or extension. Thanks a lot

Comment by migaldenis, Nov 2, 2011

need to correct some code dor calculating added and deleted lines not obligatory to unicode all content of diff file It cause MemoryError?? for huge commits(about several billion of lines) Need to fix makeunicode and getDiffLineCountDict methods by using loop at first and try...except in second one

Comment by felipe.r...@gmail.com, Jan 10, 2012

I never used Pyton before and I can't make stop 1 work right


Sign in to add a comment
Powered by Google Project Hosting