如何应用包含不存在的文件的修补程序?

时间:2014-12-15 10:43:34

标签: svn patch

我正在为svn工作副本应用补丁。在补丁文件中包含一个新文件。

补丁通常会返回这样的内容:

can't find file to patch at input line 344
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java b/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java
|new file mode 100644
|index 0000000..c10b3ae
|--- /dev/null
|+++ b/user-features/src/main/java/com/yookos/util/SearchRelevanceHelper.java
--------------------------
File to patch:

我该如何处理?

1 个答案:

答案 0 :(得分:1)

我使用cygwin patch命令尝试了你的补丁。

afusilde@LFR408288 ~/testdir
$ cat newpatch
diff --git a/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java b/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java
new file mode 100644
index 0000000..c10b3ae
--- /dev/null
+++ b/user-features/src/main/java/com/yookos/util/SearchRelevanceHelper.java

afusilde@LFR408288 ~/testdir
$ mkdir test

afusilde@LFR408288 ~/testdir
$ cd test

afusilde@LFR408288 ~/testdir/test
$ patch < ../newpatch
patching file SearchRelevanceHelper.java

afusilde@LFR408288 ~/testdir/test
$ ls
SearchRelevanceHelper.java

对我来说没问题。你使用 GNU补丁命令吗?