I've been searching for a while and still can't find a simple solution to this problem I have. I want to produce a diff between two revisions of a file but I want the output to show all lines of my file.
By the way, I'm on an AIX 5.3 using svn 1.6.17.
Example: Comparing difference between revision 21 and 22 of my file "test_file"
% svn cat -r21 test_file
My Test File
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
% svn cat -r22 test_file
My Test File
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
added after 1
added after 2
added after 3
% svn diff -r21:22 test_file
Index: test_file
===================================================================
--- test_file (revision 21)
+++ test_file (revision 22)
@@ -9,3 +9,7 @@
line 7
line 8
line 9
+
+added after 1
+added after 2
+added after 3
Now this output shows the differences in the two revisions, but not all the file's lines are there, it only shows the previous 3.
So really my question is how do I get these lines in the output??
Is there some sort of svn diff config settings? I understand I can use external diff tools for svn, but which one gives me the output I would like? I want to try and avoid installing any diff tools as I'm on a corporate network.
Additional point: So far 'sdiff' with its 2 columns generated seems to be the closest I can get to my answer, but I would ideally want a single columned file with '+' and '-' showing added/deleted lines
Thanks in advance for any help! =)
Perhaps the following is close to what you want:
First, create a diff script that will use the args received from svn appropriately:
And then diff with svn:
If you want to more closely customize the diff output you need only modify your
mydiff
script.Yes, you can use external
diff
to accomplish this. I usually do it by command like this:Here,
-U30
is unified context size. You should make it big enough to include all lines from file. For example, if your longest file has 1000 lines, you'd use-U1000
.