简体   繁体   English

Mercurial (Hg) 和二进制文件

[英]Mercurial (Hg) and Binary Files

I am writing a set of django apps and would like to use Hg for version control.我正在编写一组 django 应用程序,并希望使用 Hg 进行版本控制。 I would like each app to be independent of the others so in each app there may be a directory for static media that contains images that I would not want under version control.我希望每个应用程序都独立于其他应用程序,因此在每个应用程序中可能有一个静态媒体目录,其中包含我不希望在版本控制下的图像。 In other words, the binary files would not all be in one central location换句话说,二进制文件不会都在一个中央位置

I would like to find a way to clone the repository that would include copies of the image files.我想找到一种方法来克隆包含图像文件副本的存储库。 It also would be great if when I did a merge, if there were an image file in one repo and not another, that there would be some sort of warning.如果在我进行合并时,如果一个存储库中有一个图像文件而不是另一个存储库中会有某种警告,那也很好。

Currently I use a python script to find images and other binary files that are in one repo, but not the other.目前我使用 python 脚本来查找一个存储库中的图像和其他二进制文件,而不是另一个存储库中的图像和其他二进制文件。 But a lot of people must face this problem, so there must be a more robust and elegant solution.但是很多人肯定会面对这个问题,所以必须有一个更健壮和优雅的解决方案。

One one other thing...for reasons I do not want to go into, usually one of my repos is on a windows machine, and the other is on Linux.还有一件事......出于我不想深入的原因,通常我的一个存储库在 Windows 机器上,另一个在 Linux 上。 So a crossplatform solution would be nice.所以跨平台解决方案会很好。

Since Mercurial 2.0 the extension largefiles is now included in the main distribution.从 Mercurial 2.0 开始,扩展largefiles现在包含在主要发行版中。 That extension keeps and manages large files outside of the "normal" repository in a way that you get the benefit of DCVS but without the benefit of exponential size and processing time growth.该扩展在“正常”存储库之外保存和管理大文件,您可以从 DCVS 中获益,但没有指数大小和处理时间增长的好处。

Other extension that work along similar lines are SnapExtension and BigFilesExtension .其他类似的扩展是SnapExtensionBigFilesExtension However, those two are not distributed with Mercurial (you have to get them manually).但是,这两个未随 Mercurial 一起分发(您必须手动获取它们)。

Mercurial can track any kind of file, for binary files if something changes then the whole file gets replaced not just the changes. Mercurial 可以跟踪任何类型的文件,对于二进制文件,如果某些内容发生更改,那么整个文件都会被替换,而不仅仅是更改。

On the getting a warning if one repo doesn't contain a file, that's kind of the point of a DVCS is that the repos are related but are autonomous.如果一个回购协议不包含文件会收到警告,这就是 DVCS 的一点是回购协议是相关的但是自治的。 You could always check and see what files were added during a synch or merge operation.您始终可以检查并查看在同步或合并操作期间添加了哪些文件。

The current Mercurial book (by Bryan O'Sullivan) says, that Mercurial stores diffs also for binary files.当前的Mercurial 书(由 Bryan O'Sullivan 撰写)说,Mercurial 还存储二进制文件的差异。 How efficient this is, obviously depends on the nature of changes to binary files.这有多有效,显然取决于二进制文件更改的性质。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM