cvs2svn Documentation

Index


Requirements

cvs2svn requires the following:

CVSNT repositories

CVSNT is a version control system that started out by adding support for running CVS under Windows NT. Since then it has made numerous extensions to the RCS file format, to the point where CVS compatibility does not imply CVSNT compatibility with any degree of certainty. cvs2svn might happen to successfully convert a CVSNT repository, if the repository has never had any CVSNT-only features used on it, but this use is not supported and should not be expected to work. Patches to support the conversion of CVSNT repositories would, of course, be welcome.


Installation


Deciding how much to convert

If you're looking to switch an existing CVS repository to Subversion, you have a number of choices for migrating your existing CVS data to a Subversion repository, depending on your needs.

There are a few basic routes to choose when switching from CVS to Subversion, and the one you choose will depend on how much historical data you want in your Subversion repository. You may be content to refer to your existing (soon-to-be-converted-to-read-only) CVS repository for "pre-Subversion" data and start working with a new Subversion repository. Maybe you prefer to squeeze every last drop of data out of your CVS repository into your Subversion repository. Then again, perhaps you want a conversion somewhere in between these two. Based on these needs, we've come up with these different recommended paths for converting your CVS repository to a Subversion repository.

If you decide that top-skimming doesn't meet your needs and you're going to use cvs2svn (yay!), then be sure to read the section below on prepping your repository before you start your conversion.

Top-skimming

This is the quickest and easiest way to get started in your new repository. You're basically going to export the latest revision of your cvs repository, possibly do some rearranging, and then import the resulting files into your Subversion repository. Typically, if you top-skim, that means you'll be either be keeping your old CVS repository around as a read-only reference for older data or just tossing that historical data outright (Note to you data packrats who have just stopped breathing, please take a deep breath and put down the letter opener. You don't have to do this yourself--it's just that some people don't feel the same way you do about historical data. They're really not bad people. Really.).

Pros: Quick, easy, convenient, results in a very compact and "neat" Subversion repository.

Cons: You've got no historical data, no branches, and no tags in your Subversion repository. If you want any of this data, you'll have to go back into the CVS Repository and get it.

Trunk only

If you decide that you'd like to have the main development line of your historical data in your Subversion repository but don't need to carry over the tags and branches, you may want to skip converting your CVS tags and branches entirely and only convert the "trunk" of your repository. To do this, you'll use the --trunk-only switch to cvs2svn.

Pros:Saves disk space in your new Subversion repository. Attractive to neatniks.

Cons: You've got no branches and no tags in your Subversion repository.

Pick and choose

Let's say, for example, that you want to convert your CVS repository's historical data but you have no use for the myriad daily build tags that you've got in your CVS repository. In addition to that, you want some branches but would prefer to ignore others. In this case, you'll want to use the --exclude switch to instruct cvs2svn which branches and tags it should ignore.

Pros:You only get what you want from your CVS repository. Saves a some space.

Cons:If you forgot something, you'll have to go to your CVS repository.

Full conversion

If you want to convert your entire CVS repository, including all tags and branches, you want a full conversion. This is cvs2svn's default behavior.

Pros: Converts every last byte of your CVS repository.

Cons: Requires more disk space.

Smorgasbord

You can convert your repository (or repositories) piece by piece using a combination of the above .

Pros: You get exactly what you want.

Cons: Importing converted repositories multiple times into a single Subversion repository will likely break date-based range commands (e.g. svn diff -r {2002-02-17:2002-03-18}) since Subversion does a binary search through the repository for dates. While this is not the end of the world, it can be a minor inconvenience.

One project at a time

If you have many diverse projects in your CVS repository and you don't want to move them all to Subversion at once, you may want to convert to Subversion one project at a time. This requires a few extra steps, but it can make the conversion of a large CVS repository much more manageable. See How can I convert my CVS repository one module at a time? on the cvs2svn FAQ for a detailed example on converting your CVS repository one project at a time.

Pros:Allows multiple projects in a single repository to convert to Subversion according to a schedule that works best for them.

Cons:Requires some extra steps to accomplish the conversion. Importing converted repositories multiple times into a single Subversion repository will likely break date-based range commands (e.g. svn diff -r {2002-02-17:2002-03-18}) since Subversion does a binary search through the repository for dates. While this is not the end of the world, it can be a minor inconvenience.


Prepping your repository

There are a number of reasons that you may need to prep your CVS Repository. If you decide that you need to change part of your CVS repository, we strongly recommend working on a copy of it instead of working on the real thing. cvs2svn itself does not make any changes to your CVS repository, but if you start moving things around and deleting things in a CVS repository, it's all too easy to shoot yourself in the foot.

If you want to convert a subdirectory in your repository, you can just point cvs2svn at the subdirectory and go.

If there are any files that you don't want converted into your new Subversion repository, you should delete them or move them aside.

Lastly, even though you can move and copy files and directories around in Subversion, you may want to do some rearranging (typically of directories) before running your conversion.

Command line reference

USAGE: cvs2svn [-s svn-repos-path|--dump-only] cvs-repos-path
--help, -h Print the usage message and exit with success.
--help-passes Print the numbers and names of the conversion passes and exit with success.
--version Print the version number.
-q Tell cvs2svn to operate in quiet mode, printing little more than pass starts and stops to STDOUT.
-v Tell cvs2svn to print tons of information about what it's doing to STDOUT.
-s PATH Load CVS repository into the Subversion repository located at PATH. If there is no Subversion repository at PATH, create a new one.
-p PASS Execute only pass PASS of the conversion. PASS can be specified by name or by number (see --help-passes)
-p [START]:[END] Execute passes START through END of the conversion (inclusive). START and END can be specified by name or by number (see --help-passes). If START or END is missing, it defaults to the first or last pass, respectively.
--existing-svnrepos Load the converted CVS repository into an existing Subversion repository, instead of creating a new repository.
--dump-only Convert the CVS repository to a Subversion dumpfile instead of a Subversion repository (useful for importing a CVS Repository into an existing Subversion repository).
--dumpfile=PATH Set the PATH of the dumpfile. The default is cvs2svn-dump in the current directory.
--tmpdir=PATH Use the directory PATH for all of cvs2svn's temporary data (which can be a lot of data). The default value is the current working directory.
--dry-run Do not create a repository or a dumpfile; just print the details of what cvs2svn would do if it were really converting your repository.
--profile Dump Python Hotshot profiling data to the file cvs2svn.hotshot.
--use-cvs If RCS co is having trouble extracting certain revisions, you may need to pass this flag, which causes cvs2svn to use CVS instead of RCS to read the repository. RCS is much faster, so it's the default, but in certain rare cases it has problems with data that CVS doesn't have problems with. Specifically:
--svnadmin=PATH If the svnadmin program is not on your $PATH you should specify the absolute path to svnadmin with this switch.
--trunk-only Convert only the main line of development from the CVS repository (commonly referred to in Subversion parlance as "trunk"), ignoring all tags and branches.
--trunk=PATH The top-level path to use for trunk in the Subversion repository. The default value is "trunk".
--branches=PATH The top-level path to use for branches in the Subversion repository. The default value is "branches".
--tags=PATH The top-level path to use for tags in the Subversion repository. The default value is "tags".
--no-prune When all files are deleted from a directory in the Subversion repository, don't delete the empty directory (the default is to delete any empty directories.
--encoding=ENC Use ENC as the encoding of log messages in CVS repos (default: ascii)
--force-branch=REGEXP Force symbols whose names match REGEXP to be branches.
--force-tag=REGEXP Force symbols whose names match REGEXP to be tags. This will cause an error if such a symbol has commits on it.
--exclude=REGEXP Exclude branches and tags whose names match REGEXP from the conversion.
--symbol-default=OPT Specify how to convert ambiguous symbols (i.e., those that appear in the CVS archive as both branches and tags). OPT is one of the following:
  • "branch": Treat every ambiguous symbol as a branch.
  • "tag": Treat every ambiguous symbols as a tag.
  • "heuristic": Decide how to treat each ambiguous symbol based on whether it was used more often as a branch or tag in CVS.
  • "strict": No default; every ambiguous symbol has to be resolved manually using --force-branch, --force-tag, or --exclude. (This is the default behavior.)
--symbol-transform=PAT:SUB

Transform RCS/CVS symbol names before entering them into Subversion. PAT is a Python regexp pattern and SUB is a replacement pattern using Python's reference syntax. You may specify any number of these options; they will be applied in the order given on the command line.

This option can be useful if you're converting a repository in which the developer used directory-wide symbol names like 1_0, 1_1 and 2_1 as a kludgy form of release tagging (the C-x v s command in Emacs VC mode encourages this practice). A command like

cvs2svn --symbol-transform='([0-9])-(.*):release-\1.\2' -q -s SVN RCS

will transform a local CVS repository into a local SVN repository, performing the following sort of mappings of RCS symbolic names to SVN tags:

1-0 → release-1.0
1-1 → release-1.1
2-0 → release-2.0
--username=NAME Use NAME as the author for cvs2svn-synthesized commits (the default value is no author at all.
--skip-cleanup Prevent the deletion of the temporary files that cvs2svn creates in the process of conversion.
--bdb-txn-nosync Pass the --bdb-txn-nosync switch to "svnadmin create" when creating a new repository.
--fs-type=TYPE Pass the --fs-type=TYPE option to "svnadmin create" when creating a new repository.
--cvs-revnums Record CVS revision numbers as file properties in the Subversion repository. (Note that unless it is removed explicitly, the last CVS revision number will remain associated with the file even after the file is changed within Subversion.)
--mime-types=FILE Specify an apache-style mime.types file for setting svn:mime-type properties on files in the Subversion repository.
--auto-props=FILE Specify a file in the format of Subversion's config file, whose [auto-props] section can be used to set arbitrary properties on files in the Subversion repository based on their filenames. (The [auto-props] section header must be present; other sections of the config file, including the enable-auto-props setting, are ignored.) Filenames are matched to the filename patterns case-sensitively unless the --auto-props-ignore-case option is specified.
--auto-props-ignore-case Ignore case when pattern-matching auto-props patterns.
--eol-from-mime-type For files that don't have the kb expansion mode but have a known mime type, set the eol-style based on the mime type. For such files, set the svn:eol-style property to "native" if the mime type begins with "text/", and leave it unset (i.e., no EOL translation) otherwise. Files with unknown mime types are not affected by this option. This option has no effect unless the --mime-types option is also specified.
--no-default-eol Files that don't have the kb expansion mode and (if --eol-from-mime-type is set) unknown mime type usually have their svn:eol-style property to "native". If this option is specified, such files are left with no eol-style (i.e., no EOL translation).
--keywords-off By default, cvs2svn sets svn:keywords on CVS files to "author id date" if the mode of the RCS file in question is either kv, kvl or not kb. If you use the --keywords-off switch, cvs2svn will not set svn:keywords for any file. While this will not touch the keywords in the contents of your files, Subversion will not expand them.

A Few Examples

To create a new Subversion repository by converting an existing CVS repository, run the script like this:

   $ cvs2svn -s NEW_SVNREPOS CVSREPOS

To create a new Subversion repository containing only trunk commits, and omitting all branches and tags from the CVS repository, do

   $ cvs2svn --trunk-only -s NEW_SVNREPOS CVSREPOS

To create a Subversion dumpfile (suitable for 'svnadmin load') from a CVS repository, run it like this:

   $ cvs2svn --dump-only --dumpfile DUMPFILE CVSREPOS

As it works, cvs2svn will create many temporary files in the current directory. This is normal. If the entire conversion is successful, however, those tempfiles will be automatically removed. If the conversion is not successful, or if you specify the '--skip-cleanup' option, cvs2svn will leave the temporary files behind for possible debugging.