涉及二进制文件和文本文件时的版本控制?

发布于 2024-10-18 02:52:19 字数 331 浏览 3 评论 0原文

我有一个项目需要维护对文本和二进制文件的更改。我有几个选择:

  1. 使用补丁
  2. 使用 git 或 hg 等版本控制系统。

就我的目的而言,如果补丁只是文本文件,那么补丁是更好的选择。但是,由于有些图像可能会被替换/添加/删除,那么最好的方法是什么?

是否有一个干净的 diff/patch 实用程序也可以处理二进制差异(无需我指定它是二进制的 - 我应该能够比较整个目录而不是单个文件,但我不能与二进制模式下的 bash 差异)并将它们用作补丁? 如果不是,对于二进制文件来说,哪种版本控制系统是更干净的选择?

I have a project where I need to maintain changes to both the text and binary files. I have a couple of options:

  1. Use patches
  2. Use a versioning system like git or hg.

For my purposes, patches are a better option if it was only text files. However, since there are images that might be replaced/added/deleted, which is the best way to go?

Is there a clean diff/patch utility that can take care of binary differences as well (without me having to specify it is binary -- I should be able to diff the entire directory and not individual files, which I can't with bash's diff in binary mode) and use them as patches? If not, which versioning system is a cleaner option when it comes to binary files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

最笨的告白 2024-10-25 02:52:19

Mercurial 有补丁队列的概念(启用了 mq 扩展),很大程度上受到 quilt 的启发.
这允许您以多种方式管理补丁:

  • 使用单个补丁队列,并将所有补丁按顺序放入其中
  • 使用多个补丁队列,通过 qqueue 命令,并按适合您的标准对补丁进行分组。

作为奖励,由于补丁队列实际上是补丁文件,因此您可以轻松更改它们的顺序,甚至将它们从一个队列移动/复制到另一个队列(查看 .hg 目录以查找补丁队列)。

您可以在 Steve Losh 关于 Mercurial 队列的教程

Mercurial has the notion of patch queue (with the mq extension enabled), largely inspired by quilt.
This allows you to manage your patches in several ways:

  • Use a single patch queue and have all your patch order sequentially in it
  • Use several patch queues, with the qqueue command, and have patches grouped by whatever criteria fits you.

As a bonus, as patches queues are really patch files, you can easily change their order and even move/copy them from one queue to another (have a look in your .hg directory to find the patch queues).

You can find a lot more of usefull information about managing patch queues at Steve Losh's tutorial on mercurial queue.

甜心小果奶 2024-10-25 02:52:19

Git 和 Mercurial 都可以轻松处理文本和二进制文件。使用您喜欢的任何一个。是的,VCS 是正确的选择。

Both Git and Mercurial can easily handle both text and binary files. Use whichever you prefer. And yes, a VCS is the right choice.

背叛残局 2024-10-25 02:52:19

如果您不喜欢这样的 VCS,请尝试使用包含补丁的 ftp 服务器。版本号可以用作目录名称。该系统可以通过脚本进行支持,该脚本根据目录名称顺序应用补丁。

在我正在进行的项目中,数据库补丁就是以这种方式应用的。然而,它们是在 VCS 内维护的。文件可用于维护当前版本,脚本将读取该文件来决定应用哪个补丁。

If you don't like a VCS as such, try using a ftp server containing patches. Version numbers can be used as directory names. This system can be backed with a script, which applies patches sequentially based on directory names.

In the project I'm working on, database patches are applied in this manner. However, they are maintained inside a VCS. A file can be used to maintain the current version, which will be read by the script to decide which patch to apply.

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