suiaing
suiaing

Reputation: 31

SVN merge handling with binary file

I have a trunk and a branch A from that trunk.

I update a binary file twice to revision A and then to revision B.

If i svn merge revision B first and then revision A, conflict MUST be occur of not or conflict is depended on the content of the binary file?

If conflict is a MUST, then i can handle it manually. Otherwise, anyone can suggest a way to handle the binary file in this merge case?

Upvotes: 3

Views: 3286

Answers (1)

David W.
David W.

Reputation: 107040

There are two ways to handle this:

Don't store binary files in your repository

Many sites store their built artifacts in their Subversion repository and this isn't really a good idea. They take up lots of room, and usually have a very short shelf life. Since you can't easily purge a Subversion repository, it tends to grow very quickly. I've seen Subversion repositories that take up almost a terabyte of space reduced to a few gigabytes when we removed the binary cruft.

And, these binaries aren't all that easy to retrieve anyway. Those that really need them -- like the people who are doing testing or the deployment -- have to install Subversion on their computers and learn how to use Subversion in order to get them. Nor, is there any real purpose having various versions of these files. Their history rarely is all that enlightening for a developer.

You're better off storing your built artifacts in a release repository. We use a combination of Artifactory and Jenkins. I've used Maven repositories even when I'm not using Maven. I use them with Ant and Ivy, and I've even used it at places where we used C/C++. This allows you to share artifacts that one project produces that another project may need.

Use the svn:mime-type property on binary files

There are times when you have to store binary files because they are source. For example, GIFs, and JPGs. In this case, you can use the Subversion svn:mime-type on that file. This prevents Subversion from trying to merge binary files in the first place.

What happens when you do a merge, and there is a conflict on a binary file? You're given only two choices, you can accept yours meaning keep my current version of this file, or you can accept theirs meaning replace your current version of this binary file with the one from the other branch. This simplifies the merge/resolve process.

Upvotes: 3

Related Questions