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 DifferencesFromSubversion
|Subversion idiom||Similar darcs idiom|
|svn checkout||darcs get|
|svn update||darcs pull|
|svn status -u||darcs pull –dry-run (summarize remote changes)|
|svn status||darcs whatsnew –summary (summarize local changes)|
|svn status | grep ’?’||darcs whatsnew -ls | grep ^a (list potential files to add)|
|svn revert foo.txt||darcs revert foo.txt (revert to foo.txt from repo)|
|svn diff||darcs whatsnew (if checking local changes)|
|svn diff||darcs diff (if checking recorded changes)|
|svn commit||darcs record (if committing locally)|
|svn commit||darcs record + darcs push (if committing remotely)|
|svn diff | mail||darcs send|
|svn add||darcs add|
|svn log||darcs changes|
Here is how to convert a SVN repository into a darcs repository, using Tailor .
Sadly, tailor, as of 0.9.35, does not correctly handle svn moves. This can be manually worked around when tailor fails by doing a
rm _darcs/index, fixing _darcs/patches/pending by erasing all the lines that incorrectly show adds of files that are in the moved directories (and probably also removes of files, which may be a different bug), doing
darcs record --all --pipe and putting in the requsite meta-information etc., and then ending with another
darcs check. Tailor should then be restarted from the next patch. At minimum this requires changing the config file to set the starting revision and removing the tailor.state* files.
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
#!/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:
This recipe can be easily adapted to convert a CVS repository to a darcs one.