On May 25, 2011, at 1:35 , David Tombs wrote: > On 05/24/2011 11:05 AM, Stefan Sperling wrote: >> On Tue, May 24, 2011 at 10:45:09AM -0400, David Tombs wrote: >>> Hi Subversion Gurus, >>> >>> I have a question about merging with a tree conflict. >>> >>> I created the same directory, called 'config' on two branches. The >>> directory had different files on each branch, let's call them 'foo.java' >>> on branch A and 'bar.java' on branch B. >>> >>> When I merged branch A -> branch B, I got a "tree conflict" saying "local >>> add, incoming add upon merge." I can understand this error: the merge >>> tried to add the directory as expected but it was already there. My >>> desired resolution is to keep the 'config' directory and just add the file >>> from branch A. That is, 'config' would contain both foo.java and bar.java. >>> >>> The only way to achieve this I found was to delete 'config' (with no >>> commit), do the merge, and then revert the deletion of bar.java. It >>> worked, but it seems weird to do a delete just to revert it. Do you know >>> any better way of doing it? It took me a while to figure out the >>> solution, with lots of fruitless Googling. >> >> The problem with tree conflicts is that each one is unique. >> You might always find more creative ways of solving them. >> But I think that you've taken a very good approach. >> >> In short, whatever works for you is best :) >> > > Hi Stefan, > > Thanks for the response. Unfortunately, I don't think my solution turned > out very well. I ended up with a corrupted working copy that thought > bar.java was there but the server disagreed whenever I did a > server-hitting command. > > I guess what I should have done instead was delete config and then > re-add bar.java instead of reverting it.
Hi David, Attached is a reproduction script. I could reproduce the corrupted working copy in 1.6.16. With 1.7 (r1127008), the corruption doesn't occur, but there's still a bug: 'svn status' displays bar.java (as deleted) after the merge. The revert of bar.java has no effect. Anyway, making local changes to a working copy just to avoid tree conflicts, is a sign that Subversion's conflict resolution is lacking. There's no way to tell the merge command to resolve add-vs-add tree conflicts by merging the trees. I guess we need 'svn merge --accept theirs-conflict' (or mine-conflict) to apply to tree conflicts. That would be useful for 'svn update', too. This falls under issue 3144: http://subversion.tigris.org/issues/show_bug.cgi?id=3144 "interactive conflict resolution does not know about tree-conflicts" Note: At the end of the script I include an alternate workaround: 'svn copy ^/trunk/config/foo' to the branch. This has the advantage of preserving each file's history. Steve
merge-dir-add-add.sh
Description: Binary data
-- Stephen Butler | Senior Consultant elego Software Solutions GmbH Gustav-Meyer-Allee 25 | 13355 Berlin | Germany tel: +49 30 2345 8696 | mobile: +49 163 25 45 015 fax: +49 30 2345 8695 | http://www.elegosoft.com Geschäftsführer: Olaf Wagner | Sitz der Gesellschaft: Berlin Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
