Using Mercurial with Dropbox

If you want to take a Mercurial repository with you, you have several options:

  1. Create a server somewhere. Don’t forget to install all the security patches.
  2. Use an USB stick. Don’t forget it somewhere (like at home) and don’t forget to always push your changes onto it.
  3. Use Dropbox

Dropbox is a file server in the cloud. While they swear your data is save (“All files stored on Dropbox servers are encrypted (AES-256) and are inaccessible without your account password.” – see the features), it’s better to be safe than sorry. Also, Dropbox can’t really cope with the fast changes to the virtual filesystem done by Mercurial (this will lead to corrupt repositories and missing changesets).

The solution is to create a TrueCrypt container in your Dropbox. Dropbox won’t be able to see any changes as long as the container is mounted. When you dismount the container, Dropbox will check the file for changes (if you write to the container, TrueCrypt just modifies a few sectors). So even if you create a 100MB container, only the initial sync will be slow.

There are few obstacles, though:

  1. You must remember to mount the container, and push your changes into it.
  2. If you forget to dismount and push changes into the container on a different computer, you’ll see two containers. In this case, mount the second container somewhere, merge the changes using Mercurial and then commit to the original container.
  3. You must install TrueCrypt and Dropbox on all computers where you want to use this.
  4. The cycle “mount-push-dismount” becomes tedious over time.
  5. If you use HgEclipse, the plug-in will forget the local paths if you forget to mount the container before you start Eclipse.

2 Responses to Using Mercurial with Dropbox

  1. Dev says:

    Why not use bitbucket? They offer free, unlimited private or public hg hosting.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s