views:

210

answers:

5

I just did a merge and it seemed to work backwards to how I expected it to. I'm wondering if I did it wrong or if this a known 'issue'?

I had 2 branches Experiment/Trunk

I had done whatever I wanted to do on the experiment and merge it back to the trunk. Using Tortoise I right clicked Experiment->Merge. I chose Merge Two Different Trees and that was it (left everything else at defaults). I checked to ensure that it said Merge [Experiment] Revision Head TO [Trunk] Revision Head

Problem is, it didn't apply the differences to the trunk... it applied them to Experiment... so now Experiment was my 'trunk', which is definitely the opposite of what I wanted.

Now, I had to svn-delete the trunk and svn-copy the contents of Experiment back into the Trunk to fix it (as far as I can tell) but in the future, is that not the way it's supposed to work?

+1  A: 

I would suggest reading the free SVN Handbook, Version Control with Subversion. The relevant chapter is here.

rlbond
+1  A: 

I think you want to choose "Reintegrate a branch" not "Merge two different trees"

There's a question that covers what you want.

JeffH
The problem is that I buggered... the 'branch' had a bunch of fixes applied to it and was stable, but the trunk had work being done on it and wasn't stable. I wanted to merge the stable branch back to the trunk (to include the work that was done on it). So logically, the trunk was 'experimental' and the branch was 'stable'. Because of this, I didn't think that "Reintegrate a branch" was appropriate.
SnOrfus
+4  A: 

If your working copy is on "Experiment", that's where the result of the merge is going.

The from-to you mention is how to build the diff that will be applied, i.e it calculates the difference "from" x "to" y and applies it to the working copy.

The TortoiseSVN help explains this quite decently.

Niklas
+1  A: 

I think your fundamental misunderstanding is that you do not merge to somewhere, you merge from somewhere.

So you need to be in your trunk working folder, and merge the revision range you want from Experiment.

RedFilter
+3  A: 
  1. If you want to merge to Trunk you need to execute the merge on a working copy of Trunk. A merge produces local edits, which then need to be checked in. The target of the merge must therefore be a working copy.

  2. You're misunderstanding "TO" and "FROM".

    In a two URL merge, what you're doing is asking Subversion to compute the changes necessary to transform "FROM" into "TO" and then apply those changes to the working copy.

In your case you asked subversion to compute the changes necessary to get "FROM" Experiment "TO" Trunk and applied them to a working copy of Experiment. This will make the contents of the local working copy of your Experiment branch identical to Trunk, because that's what you asked Subversion to do.

I suggest you read the manual.

bendin