Eclipse Merge Branch into Trunk
Asked Answered
N

3

13

I am trying to merge my development branch back into the trunk of my repo. Steps I took:

  1. Switch to trunk
  2. check that it is up to date, resolve any conflicts
  3. Go to Team->Merge
  4. Select URL : development branch
  5. Start Revision: Revision when branch was created
  6. End Revision: HEAD
  7. OK

This should do the magic - it opens up the syncronize view which is fine, shows me all the conflicts, but there the problem happens:

In the compare editor I see two files: Local File | Remote File (306)

This is really strange, the revision number of the remote file is actually the one of the file in the working copy (trunk) and so is the content. The local file has the content of the file in the branch.

Now the arrow shows correctly that I am merging from left to right (branch to trunk). This also happens when I click ok.

BUT I can only move changes from right to left!!! That's not what I want - I do not want to overwrite the changes in the branches with the old content of the trunk. I want to move the content from left (branch) to right (trunk). But I can't even write in the right file.

I do not know why it writes remote file there?? It's clearly showing the working copy file in the remote file window, and the file from the branch (for merging) is shown in local file.

Some bug in Subversive?

Thx, Martin

Numerology answered 19/1, 2010 at 11:21 Comment(0)
N
6

Merges are never been easy with subversive (as mentioned in this old SO question), so may be doing the merge externally (or with subclipse) would be easier here.

If your client and repository are both at least in SVN1.5, Subversive new merge capabilities are better, but still dangerous as illustrated by this thread.

Since Subversive has been modified for SVN 1.5 the whole merge behavior has changed. One thing I really liked is the ability to choose what changes I wanted, apply that to my working copy and then commit to trunk.
Subversive now no longer does that but forces all changes onto your working copy and then you choose what to put in the trunk.

This is not only undesirable behavior but it's also dangerous (if you ignore the possibility of a revert anyway). I prefer to commit things I know work. We have a release branch which gets changes which may or may not need to be migrated to the trunk.

Neoclassic answered 20/1, 2010 at 7:42 Comment(1)
That's true..it's kind of scary that the merge happens before (without user interaction) into your working copy. And then you have to compare with the trunk and revert unwanted changes. I prefer it the other way round, (trying Versions now), where before the merge into the Working copy happens the user can choose which things to merge.Numerology
S
2

Well this seemed mysterious at first, now I shall provide a decent stab at updating this answer for everyone. This regards merging using the SVN Subversive client for Eclipse:

You are doing your merge correctly, starting in Trunk and then pointing to your file under your local Branch. Your files open up in the "Text Compare" window under the Team Synchronizing tab. If you do not see conflicts over in the left hand navigation column, then your merge has just happened. Yes, this is confusing and non-intuitive.

What the Text Compare window offers you is the ability to undo your change (or any others that may have gotten into your merged file unawares) before you commit it. Remember that you are pulling in the file from Branch, so the idea is that the Branch file is in Trunk but in a kind of virtual limbo until finally committed, and changing or undoing unwanted changes here references the file in Branch (obviously). That is why you only have a one-way pipe (Trunk to Branch) to overwrite those changed merged into Trunk via your working copy. Your merge has taken place, but it's not quite official yet.

If all looks as it should, right click the file in the navigator window (left pane in my Eclipse Helios install) and choose Accept from the drop-down. Then click back over to your main code-viewing tab (in my installation it's PHP but it could be whatever you are using) and then commit the file to Trunk.

If you want to test this, do a view of the file "as is" in Trunk before committing and you should see your changes reflected there if you have done your merge correctly. This appears to be the way it is working for me on an OSX Snow Leopard Macbook Pro. Not sure if it's the same for Windows or Linux folks. I assume it's essentially the same/similar process.

Spaniard answered 11/7, 2011 at 18:38 Comment(0)
W
0

it's easy

check out trunk with check out as... give a different project name.

Now you have both locally as working copy, trunk you wanna commit to and the branch you are working on and whose changes you have comitted to the repository. Now rightclick the trunk project (and I mean the project, not single files) - merge - select the branch project (again, PROJECT) accept all changes to local copy commit what you need to trunk as used to all fine, delete trunk again and keep working on the branch

especially with branches this seems super easy and worked like a charm for me

Widdershins answered 21/9, 2011 at 9:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.