From users-return-16475-apmail-subversion-users-archive=subversion.apache.org@subversion.apache.org Wed Oct 17 10:01:26 2012 Return-Path: X-Original-To: apmail-subversion-users-archive@minotaur.apache.org Delivered-To: apmail-subversion-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5BCB9D5A0 for ; Wed, 17 Oct 2012 10:01:26 +0000 (UTC) Received: (qmail 54583 invoked by uid 500); 17 Oct 2012 10:01:25 -0000 Delivered-To: apmail-subversion-users-archive@subversion.apache.org Received: (qmail 54252 invoked by uid 500); 17 Oct 2012 10:01:18 -0000 Mailing-List: contact users-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@subversion.apache.org Received: (qmail 54189 invoked by uid 99); 17 Oct 2012 10:01:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2012 10:01:16 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.109.42.8] (HELO einhorn.in-berlin.de) (192.109.42.8) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2012 10:01:05 +0000 X-Envelope-From: stsp@stsp.name Received: from ted.stsp.name (ted.stsp.name [217.197.84.34]) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id q9HA0iV7011480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 17 Oct 2012 12:00:44 +0200 Received: from ted.stsp.name (stsp@localhost [127.0.0.1]) by ted.stsp.name (8.14.5/8.14.3) with ESMTP id q9HA0iV9009224; Wed, 17 Oct 2012 12:00:44 +0200 (CEST) Received: (from stsp@localhost) by ted.stsp.name (8.14.5/8.14.3/Submit) id q9HA0i8j015317; Wed, 17 Oct 2012 12:00:44 +0200 (CEST) Date: Wed, 17 Oct 2012 12:00:44 +0200 From: Stefan Sperling To: Sven Uhlig , users@subversion.apache.org Subject: Re: unexpected tree conflict on merge for same source file Message-ID: <20121017100043.GA31493@ted.stsp.name> Mail-Followup-To: Sven Uhlig , users@subversion.apache.org References: <507D4254.30808@web.de> <20121016160255.GI6403@ted.stsp.name> <20121016163521.GJ6403@ted.stsp.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121016163521.GJ6403@ted.stsp.name> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Oct 16, 2012 at 06:35:21PM +0200, Stefan Sperling wrote: > Again, sticking to simple branching/merging patterns where all merges > happen between directly related branches makes things a lot easier. Hi again Sven, I've looked at this some more trying to come up with a simpler solution. It turns out that the root of all evil really is the mixed-revision copy you've made to create the first branch. If the branch is created by copying URLs the add vs. add tree conflict problem disappears. Also, a 2-URL merge is not strictly required to run the merge between the two unrelated (or "cousin") branches. But you need to sync the branch you're merging from to trunk first, which moves the common ancestor point forward in history, beyond the creation of the file which is causing the add vs. add tree conflict. This requires a record-only merge to work around the mixed-revisionness of the branch but is otherwise straightforward. Below is a unix shell script I used to reproduce the problem. See the comments inside the script for more details. #!/bin/sh set -e cwd=`pwd` basename=`basename $0` scratch_area="`echo $basename | sed -e s/\.sh$//`" repos=$scratch_area/repos trunk=$scratch_area/trunk branch1=$scratch_area/branch1 branch2=$scratch_area/branch2 trunk_url=file:///$cwd/$repos/trunk branch1_url=file:///$cwd/$repos/branch1 branch2_url=file:///$cwd/$repos/branch2 set -x rm -rf $scratch_area mkdir -p $scratch_area mkdir -p $trunk echo alpha > $trunk/alpha echo beta > $trunk/beta mkdir $trunk/gamma echo delta > $trunk/gamma/delta mkdir $trunk/epsilon echo zeta > $trunk/epsilon/zeta svnadmin create $cwd/$repos svn import $trunk $trunk_url -m "importing project tree" rm -rf $trunk svn checkout $trunk_url $trunk echo foo > $trunk/foo svn add $trunk/foo svn ci $trunk -m "add new file" # mixed-rev copy! svn copy $trunk $branch1_url -m "creating branch 1" # doing this instead would prevent tree conflicts below: # svn copy $trunk_url $branch1_url -m "creating branch 1" svn checkout $branch1_url $branch1 echo bar >> $branch1/alpha svn ci $branch1 -m "change alpha on branch 1" echo foo >> $trunk/foo svn ci $trunk -m "change foo on trunk" svn copy $trunk_url $branch2_url -m "creating branch 2" svn checkout $branch2_url $branch2 # merge branch1 into branch2 -> tree conflict # "local add, incoming add upon merge" svn merge $branch1_url $branch2 svn status $branch2 # remove merged changes and tree conflict svn revert -R $branch2 # # sync branch1 to trunk, moving the common ancestor used for the merge # beyond the creation of 'foo' to avoid the above tree conflict # # r2 created 'foo' which exists on branch1 because of mixed-rev copy. # Mark r2 as merged into branch1 to avoid another add vs. add tree-conflict. svn up $branch1 svn merge --record-only -c2 $trunk_url $branch1 # Now merging trunk -> branch1 works fine svn merge $trunk_url $branch1 svn status $branch1 svn commit -m "sync branch 1 to trunk" $branch1 # Now merging branch1 -> branch2 works fine svn update $branch2 svn merge $branch1_url $branch2 svn status $branch2 svn diff $branch2