【问题标题】:mercurial diff + unxutil "patch"mercurial diff + unxutil“补丁”
【发布时间】:2013-02-12 17:08:15
【问题描述】:

如何让 mercurial “diff”命令产生与 unix 或 unxutil patch 命令兼容的输出?

我需要创建一个补丁文件,我可以将其发送给没有安装 Mercurial 的同事。


我已尝试使用hg diff -r 3:5 > patch1.diff,但在应用它时,patch 命令出现错误。 (稍等,我会尽快发布错误消息......)


好的,这是我上传到 bitbucket 的一个测试用例:

hg clone https://bitbucket.org/jason_s/test-patch-apply P2base
hg update -r 2 -R P2base
hg diff -r 2:4 -R P2base > p2base.patch
rm -r P2base/.hg
cd P2base
patch < ../p2base.patch

我在我的 Windows PC 上得到了这个:

C:\tmp\hg\P2base>补丁

patching file bar.txt
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

【问题讨论】:

    标签: mercurial diff patch


    【解决方案1】:

    没关系,这是一个记录在案的问题(带有非常糟糕的错误消息),可以克服。来自http://gnuwin32.sourceforge.net/packages/patch.htm

    在 MS-Windows 上,补丁文件必须是文本文件,即 CR-LF 必须是 用作行尾。带有 LF 的文件可能会给出错误:“断言 失败,大块,文件patch.c,第343行,”除非选项'--binary'是 给定的。

    我使用了--binary,效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多