How to merge a "branch" that isn't really a branch (wasn't created by an svn copy)

Posted by MatrixFrog on Stack Overflow See other posts from Stack Overflow or by MatrixFrog
Published on 2010-03-23T08:12:17Z Indexed on 2010/03/23 8:13 UTC
Read the original article Hit count: 385

Filed under:
|

I'm working on a team with lots of people who are pretty unfamiliar with the concepts of version control systems, and are just kind of doing whatever seems to work, by trial and error. Someone created a "branch" from the trunk that is not ancestrally related to the trunk. My guess is it went something like this:

  1. They created a folder in branches.
  2. They checked out all the code from the trunk to somewhere on their desktop.
  3. They added all that code to the newly created folder as though it was a bunch of brand new files.

So the repository isn't aware that all that code is actually just a copy of the trunk. When I look at the history of that branch in TortoiseSVN, and uncheck the "Stop on copy/rename" box, there is no revision that has the trunk (or any other path) under the "Copy from path" column.

Then they made lots of changes on their "branch". Meanwhile, others were making lots of changes on the trunk. We tried to do a merge and of course it doesn't work. Because, the trunk and the fake branch are not ancestrally related.

I can see only two ways to resolve this:

  1. Go through the logs on the "branch", look at every change that was made, and manually apply each change to the trunk.
  2. Go through the logs on the trunk, look at every change that was made between revision 540 (when the "branch" was created) and HEAD, and manually apply each change to the "branch".

This involves 7 revisions one way or 11 revisions the other way, so neither one is really that terrible. But is there any way to cause the repository to "realize" that the branch really IS ancestrally related even though it was created incorrectly, so that we can take advantage of the built-in merging functionality in Eclipse/TortoiseSVN?

(You may be wondering: Why did your company hire these people and allow them to access the SVN repository without making sure they knew how to use it properly first?! We didn't -- this is a school assignment, which is a collaboration between two different classes -- the ones in the lower class were given a very quick hand-wavey "overview" of SVN which didn't really teach them anything. I've asked everyone in the group to please PLEASE read the svn book, and I'll make sure we (the slightly more experienced half of the team) keep a close eye on the repository to ensure this doesn't happen again.)

© Stack Overflow or respective owner

Related posts about svn

Related posts about merge