MigratingFromSubversion

Right, so you've decided to give darcs a spin, but you're a little bit lost with this business of patches, pulling and what not. Here's a custom guide for people who are used to Subversion. First of all, you might want to know about some DifferencesFromSubversionCVS

Darcs at a glance

First of all, Subversion tries to follow CVS as closely as it can. So any instructions for migrating from CVS are also applicable to Subversion. The following table is adapted from the section 'Switching from CVS' in the darcs manual

Subversion idiomSimilar darcs idiom
svn checkoutdarcs get
svn updatedarcs pull
svn status -udarcs pull --dry-run (summarize remote changes)
svn statusdarcs whatsnew --summary (summarize local changes)
svn status | grep '?'darcs whatsnew -ls | grep ^a (list potential files to add)
svn revert foo.txtdarcs revert foo.txt (revert to foo.txt from repo)
svn diffdarcs whatsnew (if checking local changes)
svn diffdarcs diff (if checking recorded changes)
svn commitdarcs record (if committing locally)
svn commitdarcs tag (if marking a version for later use)
svn commitdarcs push or darcs send (if committing remotely)
svn diff | maildarcs send
svn adddarcs add
svn logdarcs changes
?darcs tag

Converting repositories

Here is how to convert a SVN repository into a darcs repository, using Tailor .

Let us take the following project as an example: http://code.google.com/p/ppss/ First, install Tailor (apt-get install tailor on Ubuntu/Debian). Then, in a file named recipe.py, paste:

#!/usr/bin/env /usr/bin/tailor

"""
[DEFAULT]
verbose = True
patch-name-format=%(firstlogline)s
remove-first-log-line=True

[ppss]
target = darcs:ppss
root-directory = ppss_conversion
source = svn:ppss
subdir = ppss_darcs

[darcs:ppss]
darcs-command = darcs

[svn:ppss]
repository = http://ppss.googlecode.com/svn/
module = trunk 
"""

What this recipe file means is that Tailor is going to create a ppss_conversion directory where everything will happen, and inside it a ppss_darcs directory that will contain the darcs version of the initial SVN repository.

Then make it executable (chmod +x recipe.py) and run it. After a few minutes you will have your darcs repository. Of course this operation is much faster if the SVN repository you want to convert is located on your hard drive.

Moreover, Tailor enables you to maintain a two-way sync between a SVN repository and a Darcs repository: http://progetti.arstecnica.it/tailor/wiki/TwoWaySync

This recipe can be easily adapted to convert a CVS repository to a darcs one.