Mercurial and Rails Projects (no longer valid, see update!)

Mercurial is a distributed versioning system, much like the acclaimed Git in use on the Linux kernel. Even better is that capistrano2 will support Mercurial out of the box when it releases.

For now though, there are some pitfalls that you should know before throwing your next killer application into Mercurial.

1. Unless you’re using the development versions of Mercurial, symlink support is not there. This means some directories will fail to appear when you import into your repository, such as the vendor/ directory (activemailer, activesupport, etc) because they are filled with symlinks, and not real files.

A workaround for this is to currently do (when you create your rails application):
$ rails -C project

This will forgo the creation of symbolic links in vendor/. If you are importing a current project, you can also just break the symbolic links, and copy things to where they need to be.

2. Empty directories are not version controlled.

For this, you may want to simply create an empty file. This can easily be done with the touch command:

$ touch emptydirectory/placeholder

Another workaround is to have all your developers clone your repository, and then move one directory down, and run `rails directoryname` to have files re-created (entering `n` if prompted to overwrite).

Symlink support is expected to be included in Mercurial 1.0. The current release is 0.9.3.

Update: As commented, Mercurial now supports symlinks in 0.9.4. http://www.selenic.com/pipermail/mercurial/2007-June/013496.html

Advertisements