views:

73

answers:

2

Sometimes, I find myself in a situation where valid files are made invalid by doubling the contents, placing ======= in the middle, <<<<<<< .mine at the beginning and <<<<<<< .r1276 at the end. This results in unbuildable projects:

<<<<<<< .mine
using System;
using System.Data;

namespace MyNamespace
{
     class Xyz
     //... a lot more code ...
}=======
using System;
using System.Data;

namespace MyNamespace
{
     class Xyz
     //... a lot more code ...
}
>>>>>>> .r1276

It seems to want to say "the first part is mine the second part belongs revision 1276", but why does it do this and more importantly, how do I prevent it? I use AnkhSVN and Visual SVN / Tortoise from Visual Studio. I probably clicked the wrong buttons, but wdon't know which I did and would gladly hear from someone more knowledgeable with SVN how I managed to get my files to messed up and what to do to prevent it next time around.

+9  A: 

You have merging conflicts that need to be resolved. TortoiseSVN will show these files in a conflicted state, with the "Gibberish" being the way that SVN tracks the attempted merge information.

Do not alter the files manually. Use TortoiseSVN "Resolve conflicts" and the UI it provides to resolve these conflicts.

These conflicts arise after two developers have edited them and are trying to check-in their changes and the two files cannot be automatically merged.

Dave White
Sounds reasonable. Your edit on the "two developers" is very well possible in this particular situation. So how do I continue, take a file comparer and match them side by side?
Abel
The file will have a little yellow dot with a ! in the icon. Right-click, go to the TortoiseSVN menu, and find the "Resolve conflicts" item (or a similarly named menu item, I'm going from memory here)You'll get a Conflict resolution UI that is fairly intuitive.
Dave White
Ah, that where it gets fishy. The exclamation mark isn't there nor are the menus there that you talk of. I may have inadvertently changed the file, checked in again, changed it again etc before I really noticed what was going on. May that have caused the conflict-trigger to disappear?
Abel
Is TortoiseSVN installed correctly would be my first question? You wouldn't (shouldn't?) have been able to commit the file in a conflicted state. One thing that might solve this problem quickly wouuld be to just get the latest out of the repository, re-make the changes that are missing and re-commit the file into SVN.
Dave White
What I think happened is that when it was in a conflicted state, I, or someone else, tried to check it in with other means (i.e., if the conflict came through Tortoise, check in through AnkhSVN). Not sure that would work (I've had conflict before, and they need to be resolved). Ok, just checked. The version in BASE is indeed just like I described in the question :S
Abel
Hmm, or one of the used tools has a bug, of course...
Abel
I've never had a problem with TortoiseSVN yet, but I've also never used AnkhSVN. I think that if you have a merge conflict file in the head revision, I'd rollback to the prior version (with hopefully no merge conflicts in it) and re-do all your changes. Also, I would try and standardize my development group on one client tool for interactions with SVN. And I think my bias towards TortoiseSVN is apparent. :)
Dave White
@Dave: I was under the impression that the beauty of SVN is, among others, the freedom of choice for the client. But I will try to recreate the situation by creating a conflict and checking out how it is solved with various tools. We don't want this to happen again. At least now I know what it means, now I can look for the cause. Meanwhile we have reverted the changes to an earlier stable revision (of course). Thanks for your help, it's much appreciated!
Abel
+1  A: 

@Dave White gave the definitive answer (+1), and I have an additional tip, for what it's worth.... Prior to doing a get, I like to review my local changes to see if there is anything that I really should revert. I program in Delphi, so I typically have lots of .bdsproj and .res files that have silly modifications such as autoinc revisions, minor path differences, etc.. (Our "official" revision numbers come from our automated build tool, so the local ones are moot). And of course, these are lines in the file that would directly conflict with any other updates caused by the automated build, since I did my last get. By reverting my unimportant local changes prior to the "get" (svn update), I avoid dozens of senseless .mine problems.

Chris Thornton