0

when i generate .diff file from eclipse using

Java Editor -> Right click -> Team -> Create Patch

I am getting .diff file only displaying the lines of modified changes. I want to generate the .diff file with complete code of that file. Any solution for this?

Jugi
  • 1,244
  • 3
  • 23
  • 51
  • 1
    Are you on UNIX? You have very similar SO questions here: http://stackoverflow.com/questions/7983669/svn-diff-to-output-all-lines-from-files and here: http://stackoverflow.com/questions/354526/how-can-i-diff-two-files-with-full-context. – Ivan Jovović Jan 21 '15 at 15:12
  • i am using windows. Thanks for the links :) it will really help me. just for a curiosity, Is it possible to get the .diff file with full line from eclipse instead of using command ? – Jugi Jan 21 '15 at 15:16
  • i tried this command `svn diff > descriptive_name_of_patch.diff` but this produces only lines of modified changes. When i tried this command `svn diff --diff-cmd diff -x "-U30" > descriptive_name_of_patch.diff` i am getting `svn: E720087: Can't start process 'diff': The parameter is incorrect.` How to provide external diff ?? – Jugi Jan 22 '15 at 06:38

3 Answers3

1

You have asked in a comment: How to provide external diff?

Install WinMerge as external diff tool.

Then, create .bat file (make sure you pass correct path to WinMerge exe):

start "WinMerge" /B /WAIT "C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /ub /dl %3 /dr %5 %6 %7

and save it for example at

c:\wm.bat

Then pass .bat file as argument: svn diff --diff-cmd c:\wm.bat

Which will open up WinMerge and show you the differences with complete file code.

More info can be found at this SO link.

Community
  • 1
  • 1
Ivan Jovović
  • 5,238
  • 3
  • 29
  • 57
  • hi., this command opens the winmerge with complete code but if i save it as diff file , i am getting only the file path in xml format. – Jugi Jan 22 '15 at 13:54
  • How do you save the file? WinMerge > File > Save Right > Save as...? – Ivan Jovović Jan 22 '15 at 14:14
  • I want to send this diff file for code review.. I saved it as project. If i use the save right option, will it be helpful code review? – Jugi Jan 22 '15 at 14:35
  • Tools > Generate report? It will export both sides in HTML format - not sure if that fits your needs. – Ivan Jovović Jan 22 '15 at 14:53
  • hi ivan. thanks for you solutions, but this generates HTML file. I need a diff file with complete code. The code review tool accepts only diff format :( – Jugi Jan 22 '15 at 15:12
  • As you suggested this link [http://stackoverflow.com/questions/7983669/svn-diff-to-output-all-lines-from-files] provides a solution to mention the number of lines to be included in diff. I could see that it also uses the external diff. How to use that for windows? – Jugi Jan 22 '15 at 15:19
1

I had the same problem (TortoiseSvn on windows) and I solved it by downloading GetGnuWin32.exe and then following the directions in readme.txt to install it. I installed it in

Downloads\GetGnuWin32

directory. Then I opened command window in the folder and added path to diff.exe on the system Path variable as : set PATH=%PATH%;C:\Users\tbudukh\Downloads\GetGnuWin32\gnuwin32\bin.
Then ran the command: svn diff --diff-cmd=diff -x -U999999 > patch.diff

voidMainReturn
  • 3,339
  • 6
  • 38
  • 66
-1

I solved this issue by installing external diff tool called GnuWin32 and configured its path in TortoiseSvn -> Settings. Look for Merge Tool and select the option as external and provide the path of GnuWin32.

Now use the svn command as svn diff --diff-cmd diff -x -U1000 > filename.diff. This will produce diff file with 1000 lines of context. Increase -U value if your file is longer than 1000 lines. now diff file can be uploaded in any code review tool with full context.

Jugi
  • 1,244
  • 3
  • 23
  • 51