Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to have a Mercurial repository set, but instead of having the .hg/ directory under the repository tree, I would love to move it somewhere away (like to other partition) from working copy.

Is it possible to do in such a way?

share|improve this question

2 Answers 2

Since Mercurial 1.3, you can use the share extension to indirectly do what you want. Start by enabling the extension by adding the following to ~/.hgrc:

[extensions]
share =

Then create a normal repository on the partition where you want the .hg directory to be:

$ cd /mnt/bigdisk
$ hg init foo

Go to the place where you want the working copy to be and create a shared repository:

$ cd ~/src
$ hg share /mnt/bigdisk/foo

This creates a ~/src/foo repository for you. This repository will reference the /mnt/bigdisk/foo repository. There will still be a .hg folder in ~/src/foo, but it will be almost empty and thus very small. You operate on the shared repository like normal, but all commits go directly to the /mnt/bigdisk/foo repository.

The share extension works on all platforms where Mercurial runs (Windows, Mac OS X, Linux, ...) since the "symlink" is done internally by Mercurial, not via the filesystem.

share|improve this answer

There's no way to do exactly what you want. The closest would be to have a symlink .hg pointing to the real one. Please see this thread.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.