7

I have two different branches. trunk and a personal branch. The same folder was added to both branches at separate times. Now I want to merge my changes back into trunk but the folder already exists. For example (Merge personalDevBranch => trunk)

ADDED rev 123 /trunk/foo/bar.cs

ADDED rev 120 /branches/personalDevBranch/foo/baz.cs

I am using TortoiseSVN and it picks up the conflict. But it will only allow me to keep the local directory. When I do this it doesn't pick up the file baz.cs which I would have assumed should be shown as a new file for addition.

uriDium
  • 13,110
  • 20
  • 78
  • 138

2 Answers2

4

The SVN team recommend patching the file manually - in this case you should be able to select your version of the folder which would merge your baz.cs, but this will effectively delete bar.cs as you're overwriting the folder contents with your merge.

Tree conflicts are the biggest (possibly the only) problem with SVN merging. You'd think that your case (2 people adding the same folder) would be easy to merge, but its not always the case - especially with renamed files.

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148
  • Thanks. We were going to port everything to Mercurial or Git and we decided to delay it. I wish I had just done it. I think Mercurial would have handled this without a problem. – uriDium Nov 06 '13 at 09:39
  • 1
    Its just one case, that's pretty annoying of course, but still once case that is only a problem when 2 people add the same directory to 2 different branches. I would resolve using the 'theirs' version and then copy baz.cs into the folder and add it, then commit. I would install a mercurial repo somewhere and try it out. But this kind of thing needs flagging that you and a colleague have both added a folder of the same name! Usually that's a communication problem that needs manual resolution (ie you do not want your files merged into a folder full of someone else's files accidentally). – gbjbaanb Nov 06 '13 at 10:13
  • Still, I think SVN should handle tree conflicts better even though there are many cases where this is a difficult thing to do (eg what if your colleague had deleted the folder, not added it) or renames, or move files into folders.. tree conflicts are messy in the first place so don't assume its a simple thing that a tool can do what you expect it to do every time. – gbjbaanb Nov 06 '13 at 10:15
  • @gbjbaanb: I agree to your answer (same thing which I said in my answer before, but with link-reference) and also agree to your comments. So +1 for that. – Micha Nov 06 '13 at 10:36
  • We have been trying out Mercurial on a different project for a little while and merging has been a much better experience so far. Going back to SVN feels like going backwards now. Although SVN appears to be simpler. – uriDium Nov 06 '13 at 12:42
2

I faced this problem some time ago. As far as I remember, I marked the conflict in TortoiseSVN as resolved and merged this part by hand. The lesson I learned is to avoid such situations as good as possible. So in your case, just copy baz.cs in your folder.

bahrep
  • 29,961
  • 12
  • 103
  • 150
Micha
  • 5,117
  • 8
  • 34
  • 47