Mercurial 传输完整文件还是仅传输差异文件?

发布于 2025-01-03 11:03:57 字数 130 浏览 2 评论 0原文

我们有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

对不⑦ 2025-01-10 11:03:57

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 by rsync 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.

甜嗑 2025-01-10 11:03:57

已经编写了多个 Mercurial 扩展来处理大文件。它们的工作原理是对校验和进行版本控制,而不是对文件本身进行版本控制。

如果您使用 Mercurial 2.0 或更高版本,则默认情况下它包含 LargeFilesExtension。该文档解释了该扩展的工作原理:

大型文件扩展允许跟踪大型、不可压缩的文件
Mercurial 中的二进制文件不需要过多的带宽
克隆和拉动。作为大文件添加的文件不会被直接跟踪
由 Mercurial 提供;相反,它们的修订是通过校验和来识别的,
Mercurial 会跟踪这些校验和。这样,当您克隆一个
存储库或拉入变更集,旧版本中的大文件
不需要存储库的,只需要更新的
下载到当前版本。这既节省了磁盘空间,又
带宽。

您还可以使用其他扩展。这里有更多信息:处理大文件

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:

The largefiles extension allows for tracking large, incompressible
binary files in Mercurial without requiring excessive bandwidth for
clones and pulls. Files added as largefiles are not tracked directly
by Mercurial; rather, their revisions are identified by a checksum,
and Mercurial tracks these checksums. This way, when you clone a
repository or pull in changesets, the large files in older revisions
of the repository are not needed, and only the ones needed to update
to the current version are downloaded. This saves both disk space and
bandwidth.

There are also other extensions you could use. There is more information here: Handling Large Files

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文