Mercurial 中处理图像(bmp、png、jpg 等)文件合并冲突
至少,我想要的是让“hg merge”在 MS Paint 的并排实例中打开冲突版本(呃),这样我就可以手动进行合并。 MS Paint 以外的工具建议可加分。 目前我正在查看 Araxis Merge。
At a minimum, what I'd like is to have "hg merge" open up the conflicting versions in side by side instances of, say, MS Paint (ugh), so I can do the merging manually. Bonus points for tool suggestions other than MS Paint. At the moment I'm looking at Araxis Merge.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
请参阅 Mercurial wiki 中的合并工具配置页面。 您可以让 Mercurial 根据文件扩展名启动特定的合并工具。
Araxis 工具看起来很酷,但我没有使用它的经验(我使用 Linux)。 如果这对您不起作用,我会制作一个小脚本来显示所有三个图像(基本版本和两个冲突版本)并让您选择“获胜者”。
Please see the merge tool configuration page in the Mercurial wiki. You can make Mercurial launch a specific merge tool based on the file extension.
The Araxis tool look cool, but I have no experience with it (I use Linux). If that doesn't work for you, I would instead make a small script that will show all three images (the base version and the two conflicting versions) and let you choose the "winner".
您可以对图像进行 uuencode 或 base64 编码(您可以设置自动转换的挂钩),这样您在合并时就不必处理二进制文件。 但是,合并通常适用于行而不是字符,我不知道这有多有效,因为编码通常不包含新行。
You could uuencode or base64-encode the images (you can set up hooks for automatic conversion), so that you don't have to deal with binary files when merging. However, merge usually works on lines and not characters and I don't how effective this is, since the enocding usually don't contain new lines.
Araxis Merge 网站 声明它将与 Mercurial 集成。 该产品是商业产品,因此如果您有许可证,您可能需要向他们咨询有关在 Mercurial 中使用其产品的信息。
如果您没有许可证并想使用他们的产品,他们可能会帮助您使演示正常运行。 然后您可以使用假存储库模拟问题并对其进行全部测试...
如果您试图远离商业,那么基于每个文件手动配置合并工具是唯一的方法。 我不知道有任何开源或免费的绘画程序支持合并。 作为 MS Paint 的子程序,您可以配置 Paint.net 以与 Mercurial 一起使用(手动)。
The Araxis Merge website states that it will integrate with Mercurial. The product is commercial so if you have a license you might want to hit them up for information on using their product with Mercurial.
If you don't have a license and want to use their product, they'll probably help you get the demo working. Then you can mock the problem using fake repositories and test it all out...
If you are trying to stay way from Commercial, then manually configuration the merge tools on a per file basis is the only way to go. I don't know of any open source or free paint programs that would support merging. As a sub for MS Paint, you could probably configure Paint.net to work with Mercurial (manually).
以下是配置 Mercurial 以启用使用 MS Paint 合并图像的基本方法。
首先在 Windows 系统路径上的某个位置创建一个文件
mspaintmergetool.cmd
(以便 Mercurial 可以找到它),其中包含:然后将以下内容添加到
中,将 Mercurial 配置为使用此脚本合并图像。 hgrc
或mercurial.ini
:如果在合并期间名为
cat.png
的图像发生冲突,则会打开四个 MS Paint 实例:cat.png ~base
- 这是开发之前图像的样子,分为两个流,您现在尝试将其合并在一起cat.png~orig
- 这就是图像的样子在您要合并的分支中(也称为本地分支); 这是您在开始合并之前在工作目录中开始使用的图像cat.png~other
- 这就是您要合并的分支中的图像的样子 (又名远程)cat.png
- 当此 Paint 实例打开时,它最初包含与~orig
相同的图像; 您的任务是将此实例中的图像编辑为~orig
和~other
的组合,保存并退出此 Paint 实例。 退出后,Mercurial 会将冲突标记为已解决并继续合并。 请注意,前三个实例不会自动关闭,因此为了避免与潜在的剩余冲突图像混淆,您可能需要在关闭此实例之前手动关闭这些 Paint 实例。Here’s a basic way to configure Mercurial to enable the merging of images using MS Paint.
First create a file
mspaintmergetool.cmd
somewhere on the Windows System PATH (so that Mercurial may find it), containing:Then configure Mercurial to merge images using this script by adding the following to your
.hgrc
ormercurial.ini
:If during a merge an image named
cat.png
conflicts, four MS Paint instances will open up:cat.png~base
- this is what the image looked like just before development split into the two streams you are now trying to merge back togethercat.png~orig
- this is what the image looks like in the branch you are merging into (a.k.a. local); it is the image you started out with in your working directory before starting this mergecat.png~other
- this is what the image looks like in the branch you are merging from (a.k.a. remote)cat.png
- when this Paint instance opens, it initially contains the same image as~orig
; your task is to edit the image in this instance into a combination of~orig
and~other
, save, and exit this Paint instance. Upon exit Mercurial will mark the conflict as resolved and resume with the merge. Note that the first three instances will not close automatically, so to avoid confusion with potential remaining conflicting images, you might want to close those Paint instances manually before closing this one.