当涉及二进制和文本文件时的版本控制? [英] Versioning when binary AND text files are involved?

查看:273
本文介绍了当涉及二进制和文本文件时的版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


  1. 使用补丁

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

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

是否有一个干净的diff / patch工具也可以处理二进制差异(没有我必须指定它是二进制的 - 我应该能够区分整个目录而不是单个文件,在二进制模式下我不能用bash的diff),并将它们用作补丁? 如果不是,那么在二进制文件中哪个版本控制系统是一个更清洁的选项? Mercurial有补丁队列的概念(启用了mq扩展),主要受被子

这允许您以多种方式管理您的修补程序:


  • 使用单个修补程序队列和将所有补丁顺序依次存入其中

  • 使用多个补丁队列,使用qqueue命令,并根据适合您的任何标准分组补丁。



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

你可以在 Steve Losh的关于mercurial队列的教程


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?

解决方案

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.

这篇关于当涉及二进制和文本文件时的版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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