How to Migrate a CVS Check Out to Subversion

During the migration from CVS to Subversion, it may happen that you discover that the package you were working on has been migrated to Subversion before you could do a commit of your latest changes.
You do not have to worry too much: there is no magic command to automatically do the switch-over of your working copy, but it is not very difficult to do it by hand (and you need to doit only once... per package).

Here are a few examples (in order of complexity) that will cover most use cases. If your use case is not described, send a mail to and he will add it.

Before you go on, you must make a back up of the package you are working on before calling any of the suggested commands, since (in most cases) they modify your files and something may go wrong.

Only changes to files that do not conflict with a previous tag

The easiest case is the one where you modified files in ways that do not conflict with other changes committed between the latest tag and the head version you were using.

  1. Discover the latest tag you can use as a reference point
    from /doc call
cvs status release.notes
and take note of the number marked "Working revision" (e.g. 1.59), then call
cvs log -h release.notes
and look for a tag matching your the revision of the file your are using or a lower one (an official tag is better, vXrY, but user tags should be good too).
  1. Synchronize your working copy with the tag you have chosen
    from the top level directory of the package call (assuming that the tag you have chosen is somebody_20091120)
cvs -n up -r somebody_20091120
If the there are no lines starting with C and the lines starting with ? are only referring to generated files (i.e. files that you didn't explicitly modified), you fit perfectly in this case, so call again cvs without the dry run (-n) option:
cvs up -r somebody_20091120
  1. Prepare the patch containing your changes
    From the top level directory of the package call
cvs diff -u > $TMPDIR/MyPack.patch
to create a patch in a temporary directory (you can chose the directory you prefer for the temporary patch).
  1. Pick up the reference version of the package from SVN
    Remove the directory of the package (or rename it), then go to the root directory of the local project and call getpack:
getpack ThePackage somebody_20091120
getpack will do the check out from Subversion
  1. Re-apply your changes
    From the top level directory of the package call
patch -p0 -i $TMPDIR/MyPack.patch
  1. Re-synchronize with the latest revision of the package
    From root directory of the local project call again getpack:
getpack ThePackage head
This could be done with the plain svn command, but this way it is easier.
  1. Verify that your changes are working before committing to the Subversion repository.

-- MarcoClemencic - 05-Jan-2010

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2010-02-04 - MarcoClemencic
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback