Mercurial 传输完整文件还是仅传输差异文件?
我们有一个 200mb 的文件。目前,当数据发生变化时,我们使用 rsync 在开发人员之间传输它。如果我们将它作为 Mercurial 存储库的一部分,mercurial 是否只会像 rsync 一样传输 diff,还是会在更改时传输完整文件?
We have a 200mb file. We currently use rsync to transfer it between developers when it changes. If we include it as part of our mercurial repository, will mercurial only transfer the diff like rsync or will it transfer the full file when changed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Mercurial 仅在您
hg pull
时传输增量。否则分布式版本控制将根本无法工作。当您
hg pull
时,您将获得本地克隆中缺少的所有变更集。每个变更集仅包含一个增量。增量可大可小,但如果您对 rsync 今天发现的增量感到满意,那么您也应该对 Mercurial 感到满意。关于二进制文件:Mercurial 在提交时不区分“文本”和“二进制”文件。它们都受到相同的处理,并且在所有情况下都使用增量压缩。令人困惑的是,如果文件在每次编辑时都发生根本性变化,增量压缩就毫无用处——增量将与文件本身一样大。在这种情况下,Mercurial 实际上存储了文件的压缩快照。
Mercurial only transfers the deltas when you
hg pull
. Otherwise distributed version control wouldn't work at all.When you
hg pull
, you get all the changesets missing in your local clone. Each changeset only contain a delta. The delta can be small or large, but if you're happy with the deltas found byrsync
today, then you should also be happy with Mercurial.About binary files: Mercurial does not distinguish between "text" and "binary" files when making a commit. They are all treated the same and delta compression is used in all cases. What can confuse this is that delta compression is useless if a file changes radically on every edit — the delta will be just as big as the file itself. Mercurial actually stores a compressed snapshot of the file in that case.
已经编写了多个 Mercurial 扩展来处理大文件。它们的工作原理是对校验和进行版本控制,而不是对文件本身进行版本控制。
如果您使用 Mercurial 2.0 或更高版本,则默认情况下它包含 LargeFilesExtension。该文档解释了该扩展的工作原理:
您还可以使用其他扩展。这里有更多信息:处理大文件
Several Mercurial extensions have been written for handling large files. They work by versioning the checksum, rather than by versioning the file itself.
If you are using Mercurial 2.0 or later, then it includes the LargeFilesExtension by default. The docs explain how the extension works:
There are also other extensions you could use. There is more information here: Handling Large Files