Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Svn diff to output all lines from files

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! =)

like image 479
kickbackjack Avatar asked Nov 02 '11 16:11

kickbackjack


1 Answers

Yes, you can use external diff to accomplish this. I usually do it by command like this:

svn diff --diff-cmd diff -x "-U30" 

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.

like image 187
ks1322 Avatar answered Sep 23 '22 20:09

ks1322