Is it possible to change the parent of an SVN branch?

George T

There's a project for which there are 3 "editions". One is used for development, a second is used by testers to test new functionality before a new version is released, and the last is the one that is actually used by people.

Currently, the development edition is set as the trunk in SVN. The testing edition is a branch of the trunk, and the "live" edition is a branch of the testing one.

Development
     |
     v
  Testing
     |
     v
   Live

Changes are made incrementally to the development project and then merged into the testing branch in groups (one testing revision may contain the changes of several development revisions). Then once the changes are found to be OK, they're merged into the live branch and published.

However there have been situations where a change has to be made to the live branch before other changes. While things are still being tested in the testing branch (and can't yet be merged into live), another change made to the trunk has to go into live.

The way I currently do it is to make sure this one change is a separate revision in test and then merge only that one revision into live. Then, once the rest of the changes are OK, live is updated with all the interim revisions.

I'm thinking it would probably be better to have the live branch have the trunk as its parent, so that a "partial merge" will be easier to do.

   Development
        |
   -----------
   |         |
   v         v
Testing    Live

Is it possible to switch the Live branch to have the trunk as its parent (as opposed to the Testing branch) without losing its commit history?

Ben

No. Branches in SVN are just a copy. You cannot change the place you copied something from. It just is the way it is. The source of the copy is part of the history; so by definition you will not be able to change the branch source without losing some part of history.

However, being just a copy, the source of the copy is irrelevant. Nothing at all prevents you from merging directly from trunk to a branch of a branch. When you later merge from your Testing branch to Live, you may get a conflict for the twice-merge version (SVN may be smart enough to avoid that conflict) but the conflict should be easily resolved with a three-way merge tool. Probably the tool will even resolve it automatically for you.

Merge seems to get improvements every time SVN is released these days. Make sure your server and client are both up-to-date for the best possible experience in this area.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related