9

I am creating a svn diff patch, however it seems the image files are not getting included. The patch contain similar lines for each image file, as shown below:

    Index: crimgeoprofile/code/jquery/css/ui-lightness/images/animated-overlay.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: crimgeoprofile/code/jquery/css/ui-lightness/images/animated-overlay.gif
===================================================================
--- crimgeoprofile/code/jquery/css/ui-lightness/images/animated-overlay.gif (revision 1510040)
+++ crimgeoprofile/code/jquery/css/ui-lightness/images/animated-overlay.gif (working copy)

I am using the following command to create a patch:

svn diff > test.diff

Any suggestions on how I can include image files will be appreciated.

user1628340
  • 901
  • 4
  • 14
  • 27

4 Answers4

3

SVN does not support to include binary files in diffs. As a side note: git does support binary files. The resulting patch file looks like this:

diff --git a/bin/windows/SDL_mixer.dll b/bin/windows/SDL_mixer.dll
new file mode 100644
index 0000000000000000000000000000000000000000..f48ee2da696f92b66940b91b52aa53c2
GIT binary patch
literal 160256
zcmd?S4SZD9)i*kmOyYopCrYBxf<%o9l`2uFL_&=TgA|RT7>j7Ev^CX7sg%wregu+E
z26K8G$kPW}+uD|hZFwrKv_*(YAs@UMf~XNJW(<Ug6wVlm;iDl0WbXgJ_BoSD06*UQ
z-h1DBFF(yWXYaMwUVE*z*Is+=k13j2?MQYw94`DHi#Z&%c=BJq{Qc}d<;Xr~#Ovoc
zRu6jXl3M4jZ(VZNLl6HbYtG!qzCU-??5yw3`oRw#^JRVK!K}IdA7nlJgRDunPtThD

So technically it is possible, it just doesn't work with svn. So if you desperately need a patch file including binaries, consider checking out svn using git. It's easy: git svn clone http://path/to/svn. Also works similar with svn://.... You can then create a git diff, and apply that diff to any target. The target does not need to be a git repository. git apply my.patch

sulai
  • 5,204
  • 2
  • 29
  • 44
3

With Suversion 1.9 you can use --git flag for include binary content to patch file, for example:

svn diff https://storage/svn/project/trunk --git -c 42 > patch-42.diff

Subversion 1.8 already have --git flag, but ignore binary content with it.

Bozaro
  • 31
  • 2
1

Unfortunately, svn diff does not handle binary data.

Check some of the answers from: subversion diff including new files

In particular: https://stackoverflow.com/a/2255846/9822

Community
  • 1
  • 1
Jesse Vogt
  • 16,229
  • 16
  • 59
  • 72
-1

The Image files are getting included in your diff as indicated by the lines with --- and +++ but they are included as whole files in the patch - this is due in part the the problem of how to meaningfully display changes in binary data such as images in a text only format - unless you would like pages of hex differences, (such as fc -b a.gif b.gif would produce).

So you are told that the files have changed and it is up to you to decide how you would like to compare them - for image files one of the best comparisons of the significant differences is the human eye - you would not expect a revision control system to be able to tell you "This was a picture of a bald man frowning but now it is a pretty redhead cheerleader smiling" would you?

Steve Barnes
  • 27,618
  • 6
  • 63
  • 73
  • SVN cannot currently create unified patch files with binary data. If you inspect the patch file, like in Visual Studio, there is no binary data there. There's a discussion about this missing feature on the Subversion dev site: http://subversion.1072662.n5.nabble.com/Create-Apply-Patch-UTF-16-and-binary-support-td181079.html – Ron Apr 23 '14 at 19:21
  • @Ron It is not specifically that SVN cannot produce unified diff files of binaries such as image file but rather that the unified diff format does not include any method of representing the differences between two binary files. In general the delta, in text format, is likely to be larger than a fresh copy of the file unless the change is very small and localised and even then for compressed formats such as jpeg the delta between the files may be large even for a minor change. MPEG does get around this by a) using a very specific format for key frames & b) using binary format for the deltas. – Steve Barnes Apr 23 '14 at 21:34