Is it possible to keep the .hg directory in custom location
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.
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.