问题描述
我在所有编码项目中都使用了 mercurial。我现在开始一个新项目时遇到了一个问题。我有一个用于所有项目的文件。在我的新项目中,我通过 ln -s
创建了指向该文件的软链接。但是,在我使用 hg init
创建存储库后,我无法跟踪对原始文件的更改。有没有办法用 mercurial 做到这一点?
解决方法
出于安全原因,Mercurial 不遵循符号链接。据我所知,它没有公开记录,但源代码确实有一些关于它的评论。
https://www.mercurial-scm.org/repo/hg/file/33dbc9f785e7/mercurial/dirstate.py#l1082
if unknown:
# unknown == True means we walked all dirs under the roots
# that wasn't ignored,and everything that matched was stat'ed
# and is already in results.
# The rest must thus be ignored or under a symlink.
audit_path = pathutil.pathauditor(self._root,cached=True)
for nf in iter(visit):
[...]
else:
# It's either missing or under a symlink directory
# which we in this case report as missing
results[nf] = None
请注意,这部分代码正在由您自己重写,并将在接下来的几个月内更改,尽管围绕符号链接的规则将保留。