I’m really new to SVN and I’m not sure what I’m doing wrong.
I start with a repository that contains:
HelloWorld.java
I create a working set on my computer, and then copy HelloWorld.java to HelloWorldDe.java. I then rename HelloWorld.java to HelloWorldEn.java and modify a single line in HelloWorldDe.java. After this I have a working set that contains:
HelloWorldEn.java <-- Renamed copy of HelloWorld.java
HelloWorldDe.java <-- Renamed copy of HelloWorld.java with one line change
When I do SVN status i get this:
A HelloWorldDe.java
D HelloWorld.java
A HelloWorldEn.java
When I do SVN diff I get this:
Index: HelloWorldDe.java
===================================================================
--- HelloWorldDe.java (revision 0)
+++ HelloWorldDe.java (revision 0)
@@ -0,0 +1,5 @@
+public class HelloWorld {
+ public static void main( String [] args ) {
+ System.out.println("Hallo welt!");
+ }
+}
Index: HelloWorld.java
===================================================================
--- HelloWorld.java (revision 13)
+++ HelloWorld.java (working copy)
@@ -1,5 +0,0 @@
-public class HelloWorld {
- public static void main( String [] args ) {
- System.out.println("Hello World!");
- }
-}
Index: HelloWorldEn.java
===================================================================
--- HelloWorldEn.java (revision 0)
+++ HelloWorldEn.java (revision 0)
@@ -0,0 +1,5 @@
+public class HelloWorld {
+ public static void main( String [] args ) {
+ System.out.println("Hello World!");
+ }
+}
However when i try to run “patch -p0 -i German.diff” on the original working set, I end up with this:
HelloWorld.java <-- Empty file
HelloWorldEn.java
HelloWorldDe.java
Can anyone explain why I’m getting an empty file instead of the file being deleted?
It’s because patch does not delete files. It only modifies them with the content in the patch file. So this:
Won’t delete HelloWorld.java, it will only remove all the lines indicated with a
-, which is all of them.If you’d have committed the changes you made and then run
svn upthe file would have been deleted. But patch is not svn.