Converting a Repository from CVS to OIT Subversion

This document is intended to assist the reader in migrating a CVS repository to an OIT-hosted SVN service. It is primarily aimed at users whose CVS repositories came from the CS Department CVS server, which was retired. However, it should be possible to convert other CVS repositories in the same way with minor adjustments to the below instructions as warranted.

Prerequisites

Before you begin this process, you will need two important things on hand:

  • A CVS repository, packaged in a tar ball.
  • An access list consisting of the people you want to have access to your repository, and what level of access each individual should have.

For repositories originally hosted on the CS Department CVS server, you can retrieve both of these things by following instructions on this CS Guide page.

Remember that after converting your repository to SVN, all users of the repository will need to check out a new copy of the repository to a fresh location using SVN tools rather than CVS. This page from O'Reilly Media has a good introduction to SVN for CVS users.

Please take the following steps to complete your conversion:

  1. Establish an SVN repository with OIT
  2. Convert repository package from CVS to an SVN dump file
  3. Upload to OIT service
  4. Clean up

Establish an SVN repository with OIT

  • Start by filling out and submitting the Subversion Service Request form (requires Princeton OIT authentication). In the Repository Name field (after the repo name), type "<repository_name> (dump file available)". Please make sure that the name of your svn repo does not contain spaces.

  • If you need to give read/write permissions to someone who does not have a Princeton NetID, please follow instructions below:

    • Create a PI sponsored university guest account, available here: https://guestaccount.princeton.edu/. This essentially gives the outsiders a NetID (usually their email address) and a LDAP password. Once a guest account is setup, the repository owner can submit an svn request along with the guest account.
    • If it is not possible to setup a guest account (there are problems with certain names/email addresses), then OIT has the capability to setup a local svn-only account with a temporary password. OIT would prefer not to do this, but if it is necessary, the repository owner should submit a subversion request form with the guest's email address and access request, and then reply to that ticket with the additional information that the university guest acount creation failed.

Convert repository package from CVS to an SVN dump file

All cycles servers have a program called cvs2svn installed. Here you can find more information about all available options.

Please use the below examples to better understand the necessary steps.

Example CVS Repository mycvsrepo
Example Local Repository SVN_local_repo
  • If you have a local CVS repository (not stored on cvs.cs.princton.edu), make sure it has a CVSROOT directory.

  • If the repository you wish to convert is on the CS Department CVS server, please refer to this document for instructions to retrieve an archive.

  • Transfer the file somewhere with enough space to unpack it, such as the public scratch space at /n/fs/scratch. Note that if using scratch space, you should make sure to finish this process on the same day you start it in order to avoid any trouble from the automatic cleaning of scratch space.

  • gunzip and untar the file, which creates a directory named cvs

    $ ls -l mycvsrepo.tar.gz 
    -rw-r--r--. 1 joeuser joeuser 127686 Sep  9 08:21 mycvsrepo.tar.gz
    $ tar -zxvpf mycvsrepo.tar.gz
    cvs/
    cvs/baz/
    cvs/baz/baz/
    cvs/baz/baz/bash_profile,v
    cvs/CVSROOT/
    cvs/CVSROOT/loginfo,v
    cvs/CVSROOT/.#editinfo
    cvs/CVSROOT/checkoutlist
    cvs/CVSROOT/verifymsg
    cvs/CVSROOT/loginfo
    cvs/CVSROOT/taginfo,v
    cvs/CVSROOT/.#modules
    ...
    
    $ ls -l
    total 12
    drwxrwxr-x. 3 joeuser joeuser 4096 Apr  9  2007 cvs
    
  • Create an SVN dump file from the CVS repository

    $ cvs2svn --dumpfile=SVN_new_repo.dump cvs
    ----- pass 1 (CollectRevsPass) -----
    Examining all CVS ',v' files...
    cvs/CVSROOT/checkoutlist,v
    cvs/CVSROOT/commitinfo,v
    cvs/CVSROOT/config,v
    cvs/CVSROOT/cvswrappers,v
    cvs/CVSROOT/editinfo,v
    cvs/CVSROOT/loginfo,v
    cvs/CVSROOT/modules,v
    ...
    
  • gzip the file before uploading.

    gzip SVN_new_repo.dump
    

Upload SVN dump file

  • After submitting the above request form, make sure you have heard from OIT Staff that your repo is ready.

  • Temporarily change permissions on your home directory on nobel.princeton.edu to allow OIT staff to download your dump file.

    $ chmod go+x ~
  • Upload SVN_new_repo.dump.gz to nobel.princeton.edu:/u/homedirectory

    $ scp SVN_new_repo.dump.gz username@nobel.princeton.edu:/u/username/
    
  • Notify Princeton University OIT of the location of the file by replying to the auto-opened "Subversion Service Request" ticket.

  • To rename an author in your newly imported repository, first checkout your newly uploaded code and use the svn-rename-author command. Please keep in mind that, while the instructions below indicate saving your password unencrypted, this is done only for the sake of the svn-rename-author command, which will otherwise request a password many many times before completing. Storing your password unencrypted is highly discouraged for regular use, is insecure, and should be undone immediately after completing this step. For ongoing use, you should follow the instructions to disable the notice appropriately without saving your unencrypted password.

    $ svn checkout https://svn.princeton.edu/SVN_remote_repo/
    Authentication realm: <https://svn.princeton.edu/:443> Subversion repository
    Password for 'joeuser':
    -----------------------------------------------------------------------
    ATTENTION!  Your password for authentication realm:
    
       <https://svn.cs.princeton.edu:443> Subversion repository
    
    can only be stored to disk unencrypted!  You are advised to configure
    your system so that Subversion can store passwords encrypted, if
    possible.  See the documentation for details.
    
    You can avoid future appearances of this warning by setting the value
    of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
    '/home/joeuser/.subversion/servers'.
    -----------------------------------------------------------------------
    Store password unencrypted (yes/no)? yes
    
    A    SVN_remote_repo/trunk
    A    SVN_remote_repo/trunk/CVSROOT
    A    SVN_remote_repo/trunk/CVSROOT/cvswrappers
    A    SVN_remote_repo/trunk/CVSROOT/checkoutlist
    ...
    
    $ cd SVN_remote_repo
    $ svn-rename-author --help
    Usage: /usr/bin/svn-rename-author old-user-name new-user-name
    $ svn-rename-author uid41355 joeuser
    Are you sure you wish to change the author of all commits made by "uid41355" to "joeuser" (Y to continue)? Y
    property 'svn:author' set on repository revision 199
    property 'svn:author' set on repository revision 198
    property 'svn:author' set on repository revision 197
    property 'svn:author' set on repository revision 196
    ...
    
  • After you have completed the above changes, please make the following two changes:

    • Delete all the files under $HOME/.subversion/auth/svn.simple
    • In the $HOME/.subversion/servers file, add "store-plaintext-passwords = no" to the [global] section at the bottom of the file.
    • In the $HOME/.subversion/config file, uncomment the "store-passwords = no" line.

Clean up

  • Do not forget to contact Princeton OIT to let them know that your repository should be taken out of import mode. If you fail to do this, your repository data may be at risk of later corruption.
  • Undo permission changes under your home directory on nobel.princeton.edu.

    $ chmod go-x ~