Darcs to Git Conversion Tools

I've had a lot of problems with the various tools for converting repositories from darcs to git.

For the record, I'm just looking for a program that performs the simple task of a one-time conversion. Ongoing synchronization of a darcs repository with a git repository isn't something I need.

darcs2git.py

This program can be found here. This one is really picky about what version of darcs you use. If you use darcs 1.0.9, it will choke with an error like this:

We have conflicts in the following files:
./doc/sbp.html
Trying patch 580 -> patch 582
Rewinding 2 patches
There are no changes to revert!
Finished reverting.

darcs failed:  unrecognized option `-a'

This can be worked around by editing the source code and removing the -a flag from the call to darcs obliterate. Unfortunately with some complex repositories, I run into trouble with darcs2git either getting stuck spinning executing /bin/yes forever or sometimes producing a final result repository that doesn't match the darcs repository (thankfully darcs2git actually takes time to check this with diff after the conversion is finished).

If you use darcs 2.1.0, it will choke with a worse error, which I can't figure out how to work around:

megacz@mire:~$ bin/darcs2git.py edu.berkeley.sbp
Initialized empty Git repository in /home/megacz/edu.berkeley.sbp.git/
reading patches.
Starting afresh at -1
There are no changes to revert!
Finished reverting.
The repository is already consistent, no changes made.
rsync: link_stat "/home/megacz/edu.berkeley.sbp.tmpdarcs/_darcs/pristine/." failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
Traceback (most recent call last):
  File "bin/darcs2git.py", line 898, in ?
    main ()
  File "bin/darcs2git.py", line 826, in main
    conv_repo.start_at (-1)
  File "bin/darcs2git.py", line 473, in start_at
    self.checkout ()
  File "bin/darcs2git.py", line 384, in checkout
    system ('rsync -a  %(dir)s/_darcs/pristine/ %(dir)s/' % locals ())
  File "bin/darcs2git.py", line 207, in system
    raise CommandFailed ("Command failed: %s" % c)
__main__.CommandFailed: Command failed: rsync -a  \
   /home/megacz/edu.berkeley.sbp.tmpdarcs/_darcs/pristine/ \
   /home/megacz/edu.berkeley.sbp.tmpdarcs/

tailor

Not much luck with this one either. Seemed like an incredibly ambitious project.

11:04:56 [I] Bootstrapping "project" in "/private/tmp/tailor"
11:04:56 [I] /private/tmp/tailor $ git init-db
Traceback (most recent call last):
  File "/opt/local/bin/tailor", line 35, in ?
    main()
  File "/opt/local/lib/python2.4/site-packages/vcpx/tailor.py", line 339, in main
    tailorizer()
  File "/opt/local/lib/python2.4/site-packages/vcpx/tailor.py", line 144, in __call__
    self.bootstrap()
  File "/opt/local/lib/python2.4/site-packages/vcpx/tailor.py", line 65, in bootstrap
    dwd = self.workingDir()
  File "/opt/local/lib/python2.4/site-packages/vcpx/project.py", line 204, in workingDir
    self.dwd = DualWorkingDir(self.source, self.target)
  File "/opt/local/lib/python2.4/site-packages/vcpx/dualwd.py", line 68, in __init__
    self.target.prepareTargetRepository()
  File "/opt/local/lib/python2.4/site-packages/vcpx/target.py", line 569, in prepareTargetRepository
    self._prepareTargetRepository()
  File "/opt/local/lib/python2.4/site-packages/vcpx/repository/git/target.py", line 237, in _prepareTargetRepository
    self.repository.create()
  File "/opt/local/lib/python2.4/site-packages/vcpx/repository/git/__init__.py", line 126, in create
    self.runCommand(['init-db'])
  File "/opt/local/lib/python2.4/site-packages/vcpx/repository/git/__init__.py", line 73, in runCommand
    output = c.execute(stdout=PIPE)[0]
  File "/opt/local/lib/python2.4/site-packages/vcpx/repository/git/__init__.py", line 152, in execute
    return ExternalCommand.execute(self, *args, **kwargs)
  File "/opt/local/lib/python2.4/site-packages/vcpx/shwrap.py", line 156, in execute
    return self._execute(allargs, **kwargs)
  File "/opt/local/lib/python2.4/site-packages/vcpx/shwrap.py", line 254, in _execute
    raise OSError("%r does not exist!" % self._last_command[0])
OSError: 'git' does not exist!

darcs-to-git

So far this is the only one that is working consistently for me

However, it sometimes produces resulting repositories in which the ancestry relationship is not quite right – check the date on this commit and its parent.

This is not the same thing as darcs2git. It can be found here.

This one can't be run on a network filesystem, because it trips over the darcs-testing-for-nfs directory that darcs creates:

Running: ["find . -name '*-darcs-backup0'|xargs rm -f"]
a ./darcs_testing_for_nfs/
../darcs-to-git/darcs-to-git:304:in `pull': Failed to clean repo, see above (RuntimeError)
                                    from ../darcs-to-git/darcs-to-git:283:in `pull_and_apply'
                                    from ../darcs-to-git/darcs-to-git:125:in `send'
                                    from ../darcs-to-git/darcs-to-git:125:in `to_proc'
                                    from ../darcs-to-git/darcs-to-git:460:in `each'
                                    from ../darcs-to-git/darcs-to-git:460

So you just need to copy all your stuff into /tmp and work from there.