Small Example


A CVS/RCS repository grapher

Small Example



CvsGraph is a utility to make a graphical representation of all revisions and branches of a file in a CVS/RCS repository. It has been inspired by the 'graph' option in WinCVS, but I could not find a stand-alone version of this graph code. So, it was time to write one.

Where to get it

The source-code:
Tarball cvsgraph-1.7.0.tar.gz
Source RPM (see note below)
Binary RPM (see note below)
Windows Binary (compiled on XP with MSYS/MinGW)

Some notes:
Older version can be downloaded here.

Read-only access to the repository at:
Password: cvs

CvsGraph in action

ViewVC with CvsGraph

CvsGraph is officially supported by ViewVC (previously known as ViewCVS*) as of version 0.8. The CvsGraph cvs-source is viewable with ViewVC.
Note 20060102: I fixed the repository for the colored images. See the testrepository.
I have made a set of patches against ViewVC' distribution and current CVS to enable new features of CvsGraph version 1.4.x and later.
viewvc-1.0.4-cvsgraph-1.6.1.diff Diff against ViewVC version 1.0.4. Thanks to Jene Jasper for porting the patch. Please see notes below
viewvc-1.0.4-cvsgraph-1.6.1.txt Windows version of diff against ViewVC version 1.0.4. Thanks to Jene Jasper for porting the patch. Please see notes below
viewvc-1.0.1-20060906-cvsgraph-1.6.1.diff Diff against ViewVC-1.0.1. Thanks to Hendrik Tews for porting the patch.
viewcvs-1.0-dev-20040805-cvsgraph-1.4.1.diff.gz Diff against head of development (1.0-dev).
viewcvs-0.9.2-cvsgraph-1.4.0.diff.gz Diff against distribution 0.9.2.
Please note that this patch does not work with older versions of either CvsGraph or View{CVS,VC}.
Notes from Jene Jasper:
Just finished creating an update of the patch for ViewVC 1.0.4. Included a diff and txt (with Windows style path for GnuWin32: patch -i viewvc-1.0.4-cvsgraph-1.6.1.txt -p 0 [--dry-run] --verbose) file. Also changed the patch a bit:
Other notes for the patches:
The patch changes following: To apply the patch, untar the distribution, cd into the directory and run patch:
	$ tar zxf /path/to/tarball/viewcvs-0.9.2.tar.gz
	$ cd viewcvs-0.9.2
	$ zcat /path/to/diff/viewcvs-0.9.2-cvsgraph-1.4.0.diff.gz | patch -p0
		# (use other diff for 1.0-dev branch)
	$ ./viewcvs-install
Continue with the install instructions of the distribution. After installation, you might want to take a look at the cvsgraph.conf file and change some of the new options for version 1.4.x.

CvsWeb with CvsGraph

27-Feb-2004: Ville Skyttä writes from
I'm glad to announce that the new stable version of FreeBSD-CVSweb 3.0.0 has CvsGraph support built in, zero patching necessary. Feel free to update the information on this in the CvsGraph page.

For more info about FreeBSD-CVSweb, see

For historical reference:
A set of wrapper examples I made for this site constist of a php3 script which is called from cvsweb.cgi and a php3 script which wraps the image generation. Another wrapper written in perl was contributed by Sietse Visser. You might also want to modify the call to the wrapper (Internet Explorer has terrible problems rendering text/plain and insists on showing it as text/html. To view it, use a browser, or look at it with "show source" option in IE).
Another wrapper in perl, donated by Roberto Aragón Pividal, acts like the php scripts listed above to generate an image with imagemap (note that these perl scripts do not check arguments!):

An example

An example CvsGraph image
Command-line used (with default cvsgraph.conf) with source t.c,v:
./cvsgraph -O'merge_from="^source_(.*)"; merge_to="^merge_%1$"; merge_color="#e00000"' \
	-O'merge_from="^source2_(.*)"; merge_to="^merge2_%1$"; merge_color="#00e000"' \
	-O'strip_untagged=1; strip_first_rev=0; transparent_bg=1' \
	-o ../t.png -r. -m. ../t.c,v

More info


  1. I get the error "cvsgraph.c:52: #error No image output format available. Check libgd" when running make
    This is caused by libgd missing vital libraries. Please check config.log for the details of which library is missing. Then add a --with-xxx-lib=yyy to configure. Rerunning configure means that you might want to run 'make distclean' first, or remove the cache file to make sure that everything is checked.
    Most often this happens on systems where you have libgd compiled as a static library (manual installed libgd and associate libraries).
    If you know how to write proper autoconf checks, then please send me a patch, or tell me how to do it.
  2. I get lex errors "lex: illegal option -- 8"
    This is because you need to use flex. Get it from a GNU mirror near you.
  3. I get lex errors "rcsl.l", line xx: undefined symbol: rcslval"
    This is because you need to use bison. Get it from a GNU mirror near you.
  4. I get errors translating/compiling file rcsy.y
    This is because you need bison. Get it from a GNU mirror near you (byacc might work, but I do not support it).
  5. cvsgraph and/or configure can't find all (dynamic) libraries
    This seems to be a major problem on SunOS and the like. You need to check the library-path to include /usr/local/lib because many libraries end up there.
    For SunOS 5.9 you can do something like: crle -l "/usr/lib:/usr/local/lib"
    Can someone please send a patch for so that detection works?
    Also, please check the /etc/ file on Linux and check if the webserver (in conjunction with viewcvs) adds/strips a LD_LIBRARY_PATH or setting.
  6. Does CvsGraph support Subversion?
    No, no and no. Subversion is a no go because they have trashed the tree-structure of branching by making the repository a copy database. Not even tags are real, but copies of files. A quote from the subversion mailing list (alt link):
    > Does CVSGraph version 1.5.0 support subversion repositories when used with
    > development version of ViewCVS?

    The basic problem that cvsgraph solves for CVS (full history tree browsing) is at best untenable, and worst impossible, in Subversion right now (due to the design of the repository). This is a problem we aim to solve (in Subversion) in the relatively near future.
  7. I get no image in ViewVC/ViewCVS but see a Python Exception
    You probably see something similar like:
    exec failed:
     cvsgraph -i -c /.../cvsgraph.conf -r /yyy -x x -3 ... <and a lot more parameters>.... yyy/file.c,v
    Content-Type: text/html
    An Exception Has Occurred
    Python Traceback
    Traceback (most recent call last):
      File "/.../lib/", line 3611, in main
      File "/.../lib/", line 388, in run_viewvc
      File "/.../lib/", line 2226, in
        rcsfile), 'rb', 0)
      File "/.../lib/", line 125, in popen
        os.execvp(cmd, (cmd,) + tuple(args))
      File "/.../usr/lib/python2.2/", line
    299, in execvp
        _execvpe(file, args)
      File "/.../usr/lib/python2.2/", line
    337, in _execvpe
        apply(func, (fullname,) + argrest)
    OSError: [Errno 2] No such file or directory [emphasis added]
    The problem is that the cvsgraph executable cannot be run because it is not found. This is most of the time because you have misconfigured the option cvsgraph_path in the viewcvs.conf file. Please check that you have a trailing '/' in the path and that no leading or trailing whitespace is on that line.


CvsGraph is published under GNU General Public License v.2. For more information on GPL visit the GNU website.



Changes for 1.7.0
Changes for 1.6.2
Changes for 1.6.1
Changes for 1.6.0
Changes for 1.5.2
Changes for 1.5.1
Changes for 1.5.0
Pre 1.5.0 changes




As of 20 August 2005, if you send me an email with a contained or attached disclaimer that includes one or more of the following items: Then you automatically agree to pay me a license fee of DKK 1000,- for using my email address and a DKK 250,- fee for wasting my time on reading it.

Copyright © 2001-2009 - Fortune Tales & Hacker's Fortune.
Page last updated: 28-Oct-2011. Comments: mail me