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

Re: Merge confusion

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-01-05 02:09:31 CET

On Jan 5, 2006, at 01:42, Rob Brandt wrote:

> Quoting Ryan Schmidt:
>> By the way, the way you were trying to do the merge is what's
>> often called a "reverse merge" and is what you'd use to back out
>> changes inadvertently committed to the repository, or changes
>> later found to be inaccurate. If, say, I commit some changes in
>> revision 90 that are supposed to fix a bug, but later I find that
>> the fix was totally wrong and I just want to undo it and start
>> over on the fix, I can back it out by doing a reverse merge: from
>> revision 90 to 89 (think: "make a list of steps to transform
>> revision 90 back into revision 89...").
> Understood. You refer to this as a "reverse merge" because I'm
> going trunk to
> branch, rather then branch to trunk?

No, it's a "reverse merge" because you're producing a recipe that
undoes a change in the repository, as opposed to a "normal" merge
which is supposed to repeat a change in the repository.

When you do a merge, Subversion is essentially creating a diff and
applying it. You can create a diff yourself and look at it to try to
get a better understanding of what it's doing. The merge you were
requesting is the equivalent of performing the following diff on a
working copy:

svn diff -r54:42 url://to/repository/trunk

If you'll look at the output of that you'll see that every change
that you made between 42 and 54 on repository/trunk is being *undone*
by this diff. Lines you added are being taken out (they have a "-" in
front of them). Lines you changed are being changed back.

The merge you actually wanted to perform would have used this diff:

svn diff -r42:54 url://to/repository/trunk

See how now it's the right way around: lines you added are being
added again ("+" in front); lines you changed are again being
changed. That's the usual purpose of a "normal" merge: you made a
change somewhere in the repository, and now you want to repeat that
change somewhere else.

If you haven't read what The Book has to say about the subject, you
should. Here's the chapter on common use cases for merging:


This section deals with undoing changes, which might explain it
better than I could:


To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jan 5 02:12:02 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.