2013-02-12 76 views
1

如何讓mercurial「diff」命令產生與unix或unxutil patch命令兼容的輸出?mercurial diff + unxutil「patch」

我需要創建一個補丁文件,我可以發送給沒有安裝Mercurial的同事。


我使用hg diff -r 3:5 > patch1.diff嘗試和應用,當我從patch命令得到一個錯誤。 (挺住,我會盡快,因爲我有機會發布錯誤消息....)


OK,這裏是我已上傳到到位桶測試用例:

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目錄\汞柱\ P2base>補丁< ../p2base.patch

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. 

回答

1

沒關係,T他是一個可以克服的文檔化問題(具有真正的差錯誤信息)。從http://gnuwin32.sourceforge.net/packages/patch.htm

On MS-Windows, the patchfile must be a text file, i.e. CR-LF must be used as line endings. A file with LF may give the error: "Assertion failed, hunk, file patch.c, line 343," unless the option '--binary' is given.

我用--binary它工作得很好。

相關問題