tags:

views:

324

answers:

6

I'm new to SVN. After working on a branch for a day or so, I attempted to merge changes from the trunk to the branch:

svn merge svn://server/trunk

The problem is that whenever SVN encounters a conflicting file, it's not able to recognize line by line changes and marks the entire line as conflicted. I experimented with several other SVN clients and also tried to toggle the end-line and white-space options without any progress. What am I doing wrong? I think this is the simplest possible merge case, so I would expect this to work with the most default Subversion settings, any client and in any SVN version. Is it some known beginner's catch?

Client: 1.5.5 (SlikSvn:tag/1.5.5@34877) WIN32

Server: 1.4.6 (r28521), Windows

Edit

Based on the suggestions in comments and answers below, I did more investigation:

  1. The problematic files are UTF8.

  2. They don't have any SVN properties.

  3. The "svn diff" command correctly identifies the differences.

A: 

Merging in SVN is... well, it's merging in SVN. :-)

You'll have to resolve the conflict in order to merge. Other VCS tools like Bazaar (Wikipedia) or git (Wikipedia) can handle merging better most of the time due to the way that they work, having more than just the working copy stored locally. I'd recommend looking into both in the long run; if you know Subversion, Bazaar (often called bzr after it's command line program's name) may be a good option for you. I have used both, and like git, but love bzr. I even use bzr to interface with Subversion repositories that I have to work with (via the bzr-svn plugin). Bazaar is also more cross-platform than git; bzr works very well on Windows, if you have to use such an operating system. ;-)

ETA: As an aside, I used to use Subversion. The very reason I stopped was that I very much did not like its merging as that is an activity that I do regularly.

ETA2: To clarify, the only answer is to resolve the conflict. That is what you do in svn when you have a conflict. My suggestion to look into other VCSes was so that the OP can take a look and perhaps find something that will help them in the future; preferably interoperable with their current situation. I know that Bazaar does this, and I am pretty sure that git does this, though the OP since revealed that Windows is the system in use, so Bazaar would be the likely option to look into for the future. 'twasn't a "You should move to X, and now" type thing. Apologies if I was misunuderstood there. Also, Bazaar is command-line compatable (bzr co and bzr ci and bzr log, etc, making the interface very comfortable for people who know Subversion).

Michael Trausch
Advising someone to change their entire version control system because you don't know the answer to the question isn't helpful. That's a pretty major change to make, don't you think?
Ken White
Wasn't advising to change. Mayhap I was unclear. The answer is to resolve the conflict; I was merely advising that the OP look at other options to save merging headaches in the future—that's what I did, and it was well, **well** worth it.
Michael Trausch
Having had bad merge experiences with svn myself, I don't see why this is being downvoted. The OP may not be making a beginner mistake, svn may just not be able to deal with a merge situation even if it appears like it should be able to, in which case manually fixing it is the right answer...
Joshua McKinnon
It was downvoted because changing to a different VCS isn't the answer to the OP's question. The question was why SVN wasn't merging as easily as the OP thought it should; Michael's answer was "change to Bazaar or git", neither of which addressed the question or attempted to solve the problem.
Ken White
Slight clarification: Although Michael wrote "resolve the conflict", he offered no suggestion how to do so other than the long advertisement for two alternative VCSs. About as helpful as, "Gee, my PC won't boot." "You need to fix it then. Macs are really great! Jobs walks on water! OS X rules!"
Ken White
Conflict resolution is covered by Subversion's manual and often must be resolved by someone who has code access. I certainly can't tell the OP how to fix their conflict, I'd have to see what was conflicting and why. My point was, it's poss. to not do conf. res. regularly, w/ the right type of systm.
Michael Trausch
@Michael: But surely you must realize that the OP had to know that the conflicts must be resolved. His question indicated he knew that - he was looking for help on how to go about doing that. Saying "resolve the conflict" didn't help. (I can't tell the OP how either, which is why I didn't answer.)
Ken White
You still missed the mark on what I said. To spell it out, bzr has more merge algorithms and can be run against a SVN repo in the server. You get the features of bzr+compat with your SVN situation/workflow/etc., valid option. OP wanted to know if 'twas due to being a beginner or something was wrong.
Michael Trausch
Thanks for clarifying that, although I didn't miss the mark. <g> You didn't say it. You never indicated that bzr's *merge* could be run against an SVN repo, although you did mention bzr-svn. I didn't interpret "interface" to mean "use the merge functionality of bzn".
Ken White
I wasn't aware that there was additional meaning to interface. I'd assumed that you still only interface with the repository with the svn client. bzr w/ bzr-svn is also a svn client (push, pull, merge, even import entire SVN repositories, tags branches and all locally and merge and push-back).
Michael Trausch
A: 

Have you tried using TortoiseSVN? It come bundled with ToroiseMerge which I find to be a decent merging too.

Ben S
I’ve tried it, but with the same result. I was also puzzled by the interface and so I opted for the lowest common denominator: a command line client. I’ll try it one more time and provide an update.
Jan Zich
A: 

I haven't used SVN a ton, and I've only used it through the eclipse plug in, but there might be some scenarios where you simply have to tell it which case to use (your local vs the remote file). merging a set of disjoint outgoing and incoming changes isn't usually a problem, but if a line conflicts with certain types of changes (in eclipse it marks the whole line/block as red) you may just need to accept one or the other since it will probably not merge further on its own.

Pete
A: 

Check the svn:mime-type property on your files. If there is such a property set and its value does not start with 'text/', then Subversion treats those files as binary and not text.

If your files are encoded in utf-16, Subversion will also treat those files as binary by default.

Stefan
The problematic files don't have any SVN properties, but they seem to be in UTF8. Does it count?
Jan Zich
utf8 is no problem.
Stefan
+5  A: 

We had this issue recently and found that it was a problem with using a 1.4.x server and a 1.5.x client. Subversion 1.5 introduced more intelligent merging but you need the server and client to be running 1.5 to take advantage of this.

We found that specifying the range of revision numbers that we wanted to merge gave the expected results.

Mark
+1  A: 

I've selected Mark's answer. This is just to summarize and provide more details. My problem is caused by the fact that we are using SVN 1.4 which does not support the more advanced 1.5 merging features. As indicated by the selected answer, I found that I have to use the following format of the SVN merge command (in case I want to propagate changes from trunk to my branch):

svn merge svn://dpr/branches/abc@REV svn://dpr/trunk@REV

I guess that my confusion was caused by the fact that the SVN book and the clients I was using were silently assuming that I was already running 1.5 and the examples and the default merging methods were using the new features. To be fair, the introduction to the Basic Merging section in the SVN books mentions it (which I noticed only when I resolved the issue).

Jan Zich
The SVN book caused some confusion in our case as well!!
Mark