25

从 0.9.4 开始,当添加符号链接时,Mercurial 会跟踪链接本身,而不是它指向的文件或目录。但是,在某些情况下,需要跟踪符号链接指向的文件。

如何强制 Mercurial 将指向目录的符号链接视为常规目录?

4

4 回答 4

24

在linux下你可以使用

mount --bind sourcepath targetpath

而不是符号链接,mercurial 会将目标视为通常的目录(在 openSUSE 11.2 和 Mercurial 1.3.1 和 RHEL6 上测试)。

可以包含在 中的替代语法/etc/fstab

mount -o bind sourcepath targetpath

fstab 条目是,然后

sourcepath targetpath none defaults,bind 0 0
于 2010-06-10T06:03:01.913 回答
5

I was surprised when I found this too, but it seems to be a feature that the Mercurial team don't want to change for security reasons.

I'm planning to get around it by using rsync to update the local copy of the directory before committing, from my makefile. This isn't a great solution but my directory is quite small so it should be OK.

于 2010-04-03T08:35:30.193 回答
5

当您使用目录时,我认为没有办法做到这一点。

如果您使用的是 mercurial 1.3 或更高版本,您可以尝试使用新的 subrepo 支持,这将让您在本地磁盘上拥有一个 repo 跟踪内容,但它不像链接那样无缝。

于 2009-12-26T04:36:12.960 回答
2

只需跟进 Rage Steel 的出色回答(mount --bind):

为了让您的挂载在启动时准备就绪(因为挂载无法在重新启动后继续存在),请在 /etc/fstabs 中放置:

/paht/to/source /path/to/target 绑定默认值,绑定 0 0

只需确保在您的源安装后放置它。

于 2011-06-25T09:38:58.367 回答