You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Sergey Proskurnya <al...@gmail.com> on 2008/12/05 13:35:31 UTC

Incorrect diff generation using SVN "internal" diff method

Hi,

I've faced with problem trying to create unified pacth file
using internal "svn diff". The GNU "patch" utility
fails to apply that patch with the following message:
"
patching file src/server-java/app/nextapp/echo/app/HttpImageReference.java
patching file 
src/server-java/app/nextapp/echo/app/ResourceImageReference.java
missing header for unified diff at line 47 of patch
can't find file to patch at input line 47
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|,10 @@
|
|     private Extent width, height;
|     private String contentType;
|+    private int contentLength;
|     private String resource;
|     private String id;
|+    private long lastModified;
|
|     /**
|      * Creates a <code>ResourceImageReference</code>.
--------------------------
File to patch:
"
The patch command looks like
"patch -p0 --dry-run -i svn_diff_my_changes.patch".

The file "svn_diff_my_changes.patch" was generated with
the following command:
"svn.exe diff -r147:296 . > svn_diff_my_changes.patch"

So I've generated the .patch file using external GNU diff command,
which is located on my search path with the help of command:
"svn.exe diff --diff-cmd diff -r147:296 . > 
external_gnu_diff_my_changes.patch"

And this one ("external_gnu_diff_my_changes.patch") was applied 
successfully (using "patch -p0 --dry-run -i 
external_gnu_diff_my_changes.patch")!

It's no problem for me to use external diff command,
but that's the problem with SVN? Is it "behaviour by design"?

I've attached those two .patch files, see "diff_patches.zip".
You can see, they are really differ in several places.

Environment&versions info:
- Windows XP SP2
- SVN 1.5.4 (svn-win32-1.5.4.zip)
- GnuWin32 "diff -version" gives:
	diff (GNU diffutils) 2.8.7
	Written by Paul Eggert, Mike Haertel, David Hayes,
	Richard Stallman, and Len Tower.
- GnuWin32 "patch -version" gives:
	patch 2.5.9
	Copyright (C) 1988 Larry Wall
	Copyright (C) 2003 Free Software Foundation, Inc.

Thanks,
Serge.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=980106

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Incorrect diff generation using SVN "internal" diff method

Posted by Sergey Proskurnya <al...@gmail.com>.
Stefan Sperling пишет:
> Most significantly, the gnu diff uses windows line-endings
> and the svn diff uses unix-style line-endings.
> 
> svn diff tries to generate the correct eol style automatically,
> and can be confused in some cases.
> 
> Perhaps your patch program expects windows line-endings?
> Try running the svn diff through a newline converter to see if
> patch will eat it then.
> 
> I would also try playing with options such as --ignore-eol-style
> and the svn:eol-style property to see if it's possible to get svn
> to produce a usuable diff by default. (I'm not sure if svn diff
> heeds the eol-style property, I could not find an answer during
> a quick glance into the source.)
> 
> Stefan

Thanks for the hint!
Adding "-x --ignore-eol-style" option does not help,
"svn diff -x --ignore-eol-style" produce exactly the same
output as "svn diff".

Anyway, it seems strange that problem may be caused by incorrect
EOL handling by SVN - it perfectly handle EOL things automatically.

"svn diff -x -w" does not help also.


Thanks,
Serge.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=980161

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Incorrect diff generation using SVN "internal" diff method

Posted by Stefan Sperling <st...@elego.de>.
On Fri, Dec 05, 2008 at 03:35:31PM +0200, Sergey Proskurnya wrote:
> Hi,
> 
> I've faced with problem trying to create unified pacth file
> using internal "svn diff". The GNU "patch" utility
> fails to apply that patch with the following message:
> "
> patching file src/server-java/app/nextapp/echo/app/HttpImageReference.java
> patching file 
> src/server-java/app/nextapp/echo/app/ResourceImageReference.java
> missing header for unified diff at line 47 of patch
> can't find file to patch at input line 47
> Perhaps you used the wrong -p or --strip option?

> I've attached those two .patch files, see "diff_patches.zip".
> You can see, they are really differ in several places.

Most significantly, the gnu diff uses windows line-endings
and the svn diff uses unix-style line-endings.

svn diff tries to generate the correct eol style automatically,
and can be confused in some cases.

Perhaps your patch program expects windows line-endings?
Try running the svn diff through a newline converter to see if
patch will eat it then.

I would also try playing with options such as --ignore-eol-style
and the svn:eol-style property to see if it's possible to get svn
to produce a usuable diff by default. (I'm not sure if svn diff
heeds the eol-style property, I could not find an answer during
a quick glance into the source.)

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=980126

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].