This is an old revision of the document!


This page describes the FreeBSD Subversion to CVS exporter AKA svn2cvs.

The exporter runs on repoman.FreeBSD.org (mostly) in the directory /r/svn2cvs/.

Currently the page is work in progress and should not be relied on to be accurate!

svn2cvs overview

The basic purpose of the FreeBSD svn2cvs system is to replicate commits in the FreeBSD Subversion repository to the old CVS repository. svn2cvs preserves full commit information (as much as CVS allows) by exporting:

  • commit actually change content
  • commit comment
  • commit date / time
  • commit author
  • svn revision number (in the CVS commit comment)

svn2cvs exporter basically works by examining each subversion commit and then replicating it as good as possible into CVS.

Due to the way CVS works $FreeBSD$ is changed by CVS so the original $FreeBSD$ set by Subversion is overwritten by SVN. To find out which Subversion revision a file in CVS is based on, one has to see the commit log which includes the revision ID.

svn2cvs parts

svn2cvs consists of the following parts:

  • The main svn2cvs python script export.py
  • A counter stored as a SVN property telling the exporter the last SVN revision exported
  • A mapping table (called maptable and stored in export.py) which maps from SVN to CVS branches (IE, stable/7 → RELENG_7)
  • Modified version of cvs
  • Local FreeBSD svn mirror updated every 5 seconds
  • Checked out version of each active CVS branch

The counter with the last exported revision is stored as a revision property stored on revision 0 and is called fbsd:lastexp. Note that the property is stored on the mirrored repository used by the exporter, not the main FreeBSD repository. The current value for /r/svnmirror/base can be retrieved using:

svn pg fbsd:lastexp --revprop -r 0 file:///r/svnmirror/base

The modified version of CVS is changed from stock CVS as follows:

  • If the environment variable CVS_TIMESTAMP is set, use that as the commit time-stamp instead of the current 'wall clock'.
  • If the environment variable CVS_AUTHOR is set, use that to set author in CVS commit instead if the actual user which are performing the commit action (svn2cvs)
  • Do not allow 'cvs imports' to be run on the 'ncvs' repository.

All the changes to the CVS repository is done with the modified cvs binary so there is no “magic” manipulation of the CVS repository.

Create branch checklist

XXX This may _very_ well miss required steps!

  • Make sure maptable contains the new branch.
  • Create the branch in CVS e.g. using cvs tag -b RELENG_9
  • Perform the branch in svn.

How svn2cvs works, per commit

TODO

Current problems

It doesn't like when a file is 'replaced' in Subversion.

The following files in the FreeBSD repository suffers from this, as of this writing:

  • src/tools/build/options/WITH_BIND_LIBS
  • src/contrib/file/magic2mime
  • svn2cvs.1250023604.txt.gz
  • Last modified: 2009/08/11 20:46
  • by SimonNielsen