user1628340
user1628340

Reputation: 941

Include image file in svn diff patch

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.

Upvotes: 10

Views: 8966

Answers (4)

Bozaro
Bozaro

Reputation: 41

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.

Upvotes: 4

sulai
sulai

Reputation: 5354

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

Upvotes: 3

Steve Barnes
Steve Barnes

Reputation: 28370

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?

Upvotes: -1

Jesse Vogt
Jesse Vogt

Reputation: 16499

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

Upvotes: 1

Related Questions