r3 - 13 Jul 2007 - 11:06:05 - MimiYinYou are here: OSAF >  Projects Web  >  BuildProject? > CvsToSvn

CVS to SVN

We are moving the source repository from CVS to SVN. To ensure a fairly smooth transistion we will keep track of various tasks here.

The discussion and notes leading up to deciding to switch is documented on the SwitchingVersionControlSystems page. This page is to be more task oriented.

People

Notes

During testing, I found that we had two files that were being flagged by cvs2svn. Since they were not valid files to begin with it was easy enough to delete them from the working cvs directories.

  • hardhat/Attic/hardhat.py,c
  • CVSROOT/dolog.pl,v

Another item found during testing was a single tag id that was also the name of a branch - cvs2svn requires it to be one or the other so I added the

--force-branch=rel-0_1-maint
option to the command line.

Create source directories

Because of the way cvs2svn works, it is easier to create a working directory that mirrors the cvs modules you want to be included in each new svn repository. To be extra safe I copied each module into a new directory and ran cvs2svn on each one.

    tar czf /svn/work/cvsrep_backup.tgz /usr/local/cvsrep

    mkdir /svn/work/r_chandler
    mkdir /svn/work/r_server
    mkdir /svn/work/r_archive
    mkdir /svn/work/r_docs

    cp -r /usr/local/cvsrep/CVSROOT /svn/work/r_chandler
    cp -r /usr/local/cvsrep/chandler /svn/work/r_chandler
    cp -r /usr/local/cvsrep/internal /svn/work/r_chandler
    cp -r /usr/local/cvsrep/external /svn/work/r_chandler
    cp -r /usr/local/cvsrep/hardhat /svn/work/r_chandler
    cp -r /usr/local/cvsrep/CVSROOT /svn/work/r_server
    cp -r /usr/local/cvsrep/cosmo /svn/work/r_server
    cp -r /usr/local/cvsrep/server /svn/work/r_server
    cp -r /usr/local/cvsrep/commons /svn/work/r_server
    cp -r /usr/local/cvsrep/CVSROOT /svn/work/r_docs
    cp -r /usr/local/cvsrep/docs /svn/work/r_docs
    cp -r /usr/local/cvsrep/CVSROOT /svn/work/r_archive
    cp -r /usr/local/cvsrep/Attic /svn/work/r_archive
    cp -r /usr/local/cvsrep/old /svn/work/r_archive

Create the dump files

    cd /svn/work/cvs2svn-1.2.1
    ./cvs2svn --dump-only --use-cvs --force-branch=rel-0_1-maint --dumpfile /svn/work/r_chandler.dump /svn/work/r_chandler
    ./cvs2svn --dump-only --use-cvs --force-branch=rel-0_1-maint --dumpfile /svn/work/r_server.dump /svn/work/r_server
    ./cvs2svn --dump-only --use-cvs --force-branch=rel-0_1-maint --dumpfile /svn/work/r_archive.dump /svn/work/r_archive
    ./cvs2svn --dump-only --use-cvs --force-branch=rel-0_1-maint --dumpfile /svn/work/r_docs.dump /svn/work/r_docs

Create the repositories and adjust permissions

    svnadmin create --fs-type=fsfs /svn/chandler
    svnadmin create --fs-type=fsfs /svn/server
    svnadmin create --fs-type=fsfs /svn/docs
    svnadmin create --fs-type=fsfs /svn/archive

    chown -R apache:svn /svn/chandler
    chown -R apache:svn /svn/server
    chown -R apache:svn /svn/docs
    chown -R apache:svn /svn/archive

    chmod -R g+w /svn/chandler/db
    chmod -R g+w /svn/server/db
    chmod -R g+w /svn/docs/db
    chmod -R g+w /svn/archive/db

Loading dump files into the repositories

    svnadmin load /svn/chandler < /svn/work/chandler.dump
    svnadmin load /svn/server   < /svn/work/server.dump
    svnadmin load /svn/docs     < /svn/work/docs.dump
    svnadmin load /svn/archive  < /svn/work/archive.dump

Converting keywords

Note: Must be done in a working and also it's no longer needed as it is done automatically by cvs2svn now

  egrep -rl '\$Id: '       * | grep -v /.svn/ | xargs svn propset svn:keywords Id
  egrep -rl '\$Author: '   * | grep -v /.svn/ | xargs svn propset svn:keywords Author
  egrep -rl '\$Revision: ' * | grep -v /.svn/ | xargs svn propset svn:keywords Revision

Converting .cvsignore entries

Note: current version of cvs2svn does this automatically now

    for f in $(find . -name .cvsignore); do
        svn propset svn:ignore -F $f $(dirname $f);
        svn rm $f;
    done

post-commit (must be apache:svn and +x)

    #!/bin/sh
    REPOS="$1"
    REV="$2"
    AUTHOR=`/usr/bin/svnlook author -t $REV $REPOS
    /usr/bin/svnnotify -p "$1" -r "$2" -t "commits@osafoundation.org" -l /usr/bin/svnlook 
            -P "[commits] ($AUTHOR)" 
            -B "http://bugzilla.osafoundation.org/show_bug.cgi?id=%s" 
            -U "http://cvs.osafoundation.org/viewcvs.cgi?rev=%s&view=rev" 
            -d -H HTML::ColorDiff

pre-commit (must be apache:svn and +x)

  #!/bin/sh
  REPOS="$1"
  TXN="$2"
  SVNLOOK=/usr/bin/svnlook

  python /svn/scripts/notabs.py $REPOS $TXN $SVNLOOK || exit 1

  exit 0
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.