How to treat a symbolic link as a directory in Mercurial?

D R picture D R · Dec 25, 2009 · Viewed 10.5k times · Source

As of 0.9.4, when adding a symbolic link Mercurial keeps track of the link itself, and not the file or directories it points to. However, there are cases when it is desirable to keep track of the files pointed to by the symbolic link.

How can I force Mercurial to treat the symbolic link to a directory as a regular directory?

Answer

Rage Steel picture Rage Steel · Jun 10, 2010

Under linux you can use

mount --bind sourcepath targetpath

instead of symbolic links and mercurial will treat target as usual directory (tested on openSUSE 11.2 with Mercurial 1.3.1, and on RHEL6).

The alternative syntax, amenable for inclusion in /etc/fstab, is

mount -o bind sourcepath targetpath

The fstab entry is, then

sourcepath targetpath none defaults,bind 0 0