views:

40

answers:

1

Is there a way to place the repository (.hg/) not in the same directory as the working copy?

Like you can in Git by using GIT_DIR and GIT_WORK_TREE environment variables.

Background: I want to use Mercurial to keep track of modifications in important directories on Linux and Solaris servers. But I want to avoid polluting delicate directories with any "alien" files (like /platform/... or /kernel/drv/ on Solaris).

+1  A: 

There isn't. However, you can always have the .hg directory further up. You could have it as /.hg and have .* in your .hgignore. Then just add whatever you want at whatever depth you want.

Also checkout etckeeper if you're using this for system files where ownership and permissions matter.

Ry4an
After searching for a while I can confirm. There isn't a feature like $GIT_DIR / $GIT_WORK_TREE. The next best thing for my case is a symbolic link for .hg/.
Paidhi