How to merge an improperly created "branch" that isn't really a branch (wasn't created by an svn cop
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:53 UTC
Read the original article
Hit count: 360
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:
- They created a folder in
branches
. - They checked out all the code from the trunk to somewhere on their desktop.
- 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:
- Go through the logs on the "branch", look at every change that was made, and manually apply each change to the trunk.
- 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