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.


3 responses to “Mercurial and Rails Projects (no longer valid, see update!)

  1. anonymous coward

    Symlinks are now supported, in the fresh 0.9.4!

  2. I had a similar issue with Ruby and IDEA due to the symlinks.

    Rails doesn’t use symlinks in the vendor directory any more, so rather than using the Ubuntu packaged Rails I installed the latest via rubygems and life is good now. Not sure if this is similar to your issue but wanted to pass it on!

  3. Joe Block

    So is there a way to get script/generate to use mercurial the same way –svn does?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: