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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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
[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
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.
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.