[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Why is --reintegrate needed for svn 1.5 merging?

From: Mark Phippard <markphip_at_gmail.com>
Date: Fri, 30 May 2008 10:55:47 -0400

Subversion's merge feature is generally based on revisions. Either
you include or exclude a revision in the merge. The Merge Tracking
feature is about recording which revisions you have already merged and
potentially allowing you to just merge all the revisions you do not
have.

This general merge concept does not work correctly when you get into a
"cyclic" or "reflective" merge scenario. Meaning, you create a branch
from trunk, make changes on branch. Merge changes from trunk to
branch and then eventually merge from branch back to trunk.

The problem is the step where you merged changes from trunk to the
branch. When you did this, it created a revision on your branch.
When you want to merge that branch back to trunk, Subversion is only
capable of doing one of two things. Include the revision, or do not
include the revision. Neither answer is generally correct because it
is possible, even likely, that the revision contains other changes
that go beyond the merge. For example, the merge might have required
conflict resolution. If you simply exclude this revision, then you
also exclude the conflict resolution.

If you do not use the --reintegrate option, then these revisions are
included in the merge back to trunk. In some, but not all cases, this
will causes unnecessary conflicts because trunk already has the
changes trying to be applied.

So all of the above is the problem. Subversion already had in place a
merge solution that is capable of producing the desired results. This
is called a 2-URL merge because of the syntax it requires. For
example, to merge a branch back to trunk.

svn merge url://trunk@LAST-REV url://branch

Where LAST-REV is the last revision from trunk that was merged to the branch.

The --reintegrate option was added as a syntax shortcut to make this
type of merge easier to use. The above merge becomes this:

svn merge --reintegrate url://branch

Internally, this code figures out and runs the above merge. It is
worth pointing out that because it is doing a lot of logic for you, it
was decided that it should also do a lot of safety checks and error
out without doing the merge if these checks fail. Some of these
checks might prevent you from using this syntax and you might then
have to use the 2-URL syntax in place of it.

Hopefully this answers your question.

-- 
Thanks
Mark Phippard
http://markphip.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-05-30 16:56:15 CEST

This is an archived mail posted to the Subversion Users mailing list.