我有一个像这样的补丁文件:
Index: dir/file.xml
===================================================================
--- dir/file.xml (revision 178)
+++ dir/file.xml (working copy)
@@ -7,7 +7,7 @@
<markup>
- <markup />
+ <markup></markup>
<markup>
<markup>
@@ -20,6 +20,7 @@
<markup>
<markup>
+ <tag>
<markup>
Run Code Online (Sandbox Code Playgroud)
要将它应用于SVN工作副本,我使用以下方法对其进行分支:
$ svn copy -r 178 trunk/component/dir branches/mybranch
Run Code Online (Sandbox Code Playgroud)
然后我试了一下
$ cd branches/mybranch
$ ls -R
./dir:
file.xml
$ patch -p0 -i ~/patchfile.patch
Run Code Online (Sandbox Code Playgroud)
但SVN的输出是
(Stripping trailing CRs from patch.)
patching file dir/file.xml
Hunk #1 FAILED at 7.
Hunk #2 FAILED at 20.
2 out of 2 hunks FAILED -- saving rejects to file dir/file.xml.rej
Run Code Online (Sandbox Code Playgroud)
对于每个文件?
什么可能导致SVN拒绝补丁?我在UNIX机器上,但补丁和存储库有Windows行结束...
感谢帮助!
该dos2unix提示是不坏,但作为建议并没有解决问题.
我做了什么来实际修补所有文件:
$ cd branches/mybranch
$ sudo apt-get install tofrodos
$ fromdos ~/patchfile.patch
$ fromdos */*
$ patch -p0 -i ~/patchfile.patch
$ todos */*
Run Code Online (Sandbox Code Playgroud)
所以基本上patch似乎CR/LF在Unix下处理线路时遇到问题.将其转换为LF,然后修补并在修补后将其转换回来帮助.
致Stefan的信用.
| 归档时间: |
|
| 查看次数: |
12777 次 |
| 最近记录: |