在Windows上使用Mercurial跟踪硬链接或符号链接 [英] Tracking hard or symbolic links with mercurial on Windows

查看:46
本文介绍了在Windows上使用Mercurial跟踪硬链接或符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个相当大的项目中,我想将相同的文件(或文件夹)放在不同的位置.在一个位置进行更改时,应传播更改.在Subversion中,我可以使用外部来实现此行为.

我试图通过使用硬链接和符号链接来解决此问题,但Mercurial似乎没有跟踪它们中的任何一个.而是将文件的内容而不是link属性提交到其存储库.当我克隆存储库时,信息会丢失.

这是Mercurial的Windows特定行为,还是根本无法跟踪链接?有没有其他方法可以跟踪可从Mercurial中的不同位置访问的文件?

解决方案

Mercurial 可以跟踪符号链接,但是在Windows上签出时它们看起来很奇怪.发生的情况是,Mercurial创建了一个 link target 作为文件 content 的文件.不幸的是,不支持在支持Windows的Windows系统(例如Windows Vista)上创建真实的符号链接.这样的结果是,您不能在应该在两个系统之间移植的存储库中使用符号链接.请参阅Issue1825中的讨论以获取有关此功能的更多信息.

svn:externals最接近的匹配项是 Mercurial子存储库.根据您使用svn:externals的方式,subrepos可能是您想要的,也可能不是.请查看我的答案有关子仓库的另一个问题,以获取一些建议.我为subrepos写了一部分代码,然后脑袋冒出了头,我认为在同一主存储库中多次安装subrepo听起来像是使人困惑的秘诀.但是也许您可以使它起作用-请注意,子仓库是Mercurial的棘手部分.

In a rather large project, I would like to put the same file (or folder) in different locations. When it is changed in one location, the changes should be propagated. In Subversion, I could use externals to achieve this behavior.

I tried to solve this by using hard links and symbolic links, but Mercurial seems to not track any of them. Instead, it commits the content of the files to its repository instead of the link property. When I clone the repository, the information is lost.

Is this a Windows-specific behavior of Mercurial or can't it track links at all? Is there another way to track a file that is accessible from different locations in Mercurial?

解决方案

Mercurial can track symbolic links, but they look strange when checked out on Windows. What happens is that Mercurial creates a file with the link target as the file content. There is unfortunately no support for creating real symbolic links on Windows systems that support them, such as Windows Vista. The result of this is that you cannot use symbolic links in a repository that is supposed to be portable between both systems. Please see the discussion in Issue1825 for more on this feature.

The closest match for svn:externals is Mercurial subrepositories. Depending on how you used svn:externals, subrepos may or may not be what you want. Please see my answer to another question about subrepos for some advice. I wrote part of the code for subrepos and off the top of my head, I think mounting a subrepo several times in the same main repository sounds like a recipe for confusion. But maybe you can make it work — just be aware that subrepos are a tricky part of Mercurial.

这篇关于在Windows上使用Mercurial跟踪硬链接或符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆