I am encountering an issue with "svn merge --reintegrate" when doing
round-trip branch-trunk merges. Yes, I know these are problematic, but
we don't have problems with them except for this one case.
The general scenario is:
1. Create a new file on the branch.
2. svn merge --reintegrate to the trunk.
3. Modify the file on the branch.
4. svn merge --reintegrate to the trunk.
The second merge will raise the file as a tree-conflict: "local add,
incoming add upon merge".
If a --record-only trunk-to-branch merge is done of the revision created
by step #2 above, this tree-conflict is avoided. (We normally do this
kind of record-only merge only when merging trunk changes to the branch
and not in this scenario).
"svn merge ^/trunk ^/branch" for step #4 doesn't have this problem. (I
find this interesting, but perhaps it's perfectly logical.)
I see this behavior with both 1.6.6 and 1.6.9. Is this a bug?
I've attached a script that reproduces the scenario.
--
David Rothenberger ---- daver...@acm.org
"It takes all sorts of in & out-door schooling to get adapted
to my kind of fooling"
-- R. Frost
#!/bin/sh
######################################################################
# This is a reproduction recipe for a problem seen in 1.6.9 where a
# --reintegrate merge causes tree conflicts.
#
# The scenario is that a file is added on a branch and then
# --reintegrated to the trunk. The file is then modified on the
# branch and that is --reintegrated to the trunk. The second merge
# raises a tree-conflict on the file.
#
# There are two known work-arounds:
# 1. Do a record-only merge of the revision created in the first
# merge on the branch.
# 2. Use an old-style trunk-to-branch-diff merge for the second
# branch-to-trunk merge.
######################################################################
# Define this to do the record-only merge in the trunk that avoids the problem.
#DO_RECORD_ONLY=yes
# Define this to use a diff merge instead of reintegrate
#DO_DIFF_MERGE=yes
R=file://${PWD}/repos
# Clean up from a previous run
rm -fr repos trunk branch
# Create the repository
svnadmin create repos
# Create a trunk wc
mkdir trunk
svn import -m '' trunk $R/trunk
svn co --force $R/trunk trunk
# Create a branch
svn cp -m '' $R/trunk $R/branch
svn co $R/branch
# Add a new file in the branch.
cd branch
touch a
svn add a
svn ci -m 'Added a'
# Merge it into the trunk
cd ../trunk
svn up
svn merge --reintegrate ^/branch
svn ci -m 'Merged branch to trunk'
# Modify a in the branch
cd ../branch
date > a
svn up
svn ci -m 'Modified a'
# Optionally do record-only merge
if [ "$DO_RECORD_ONLY" = yes ]; then
svn up
svn merge --record-only ^/trunk
svn ci -m 'Record reintegrate'
fi
# Merge change of a to trunk
cd ../trunk
svn up
if [ "$DO_DIFF_MERGE" = yes ]; then
svn merge ^/trunk ^/branch
else
svn merge --reintegrate ^/branch
fi