CVS to SVN migration and Branch within a branch

180 Views Asked by At

I did a recent migration from CVS to SVN using cvs2svn tool. In the newly migrated project for one of my projects the latest version is part of a branch say branch A(Parent Directory). Within this project, I have a subproject, whose latest version is another branch say Branch B.So basically trunk doesn't have the latest version of my Main project.

So in CVS once I checkout my parent folder(Branch A), I would browse upto my subproject > Right+Click > CVS > Update Special > choose Branch B (As Branch B has the latest for subproject). This would checkout the latest version for the subproject and I would have the latest version of my Main Project.

In SVN however, I do not see this option. SVN as far as I know, can only update with a revision and not a branch. I am new to SVN, so there is more probability that I'm wrong. Is there a way to do what I was trying to do in the CVS scenario?

I figured out a round about way to checkout the main project(Branch A) and then checkout the sub-project separately(Branch B). Then I would delete this subproject from the first checkout(Parent project-Branch A) and replace it with the second checkout version of subproject.

2

There are 2 best solutions below

1
On

It sounds like you were attempting to do Sparse Branching. In Sparse Branching, you have one branch as your base (we'll call Branch A) and on another branch (we'll call Branch B), you only put the changes from Branch A, and not the entire branch.

This is sometimes done in CVS because branching takes a long time to do. We found it taking 20 minutes for small projects, and up to an hour for large projects. However, it ends up being very difficult to track, and I've found that sites that use it tend to lose track of how checkouts are suppose to be done. Continuous build systems also cannot handle CVS Sparse Branching setups.

Subversion doesn't do Sparse Branching (at least very easily), but branching in Subversion is quick and simple to do. Creating a branch takes less than a second. In Subversion, you should take Branch A, and create Branch B off of Branch A. Then, you put all the differences between Branch A and Branch B onto Branch A. Changes to Branch A must be merged to Branch B on a regular basis.

The problem with sparse branching is that if a file is changed on both branches, it is never picked up. With merging, the changes on both branches are added to the file on Branch B. It's why so few sites do Sparse Branching.

You need to create a new Branch B from Branch A, and then make all the changes that are on your old Branch B onto this new Branch B and check it in. Then, Branch B will contain all the files it needs, you can use continuous integration systems, and checking files in and out is a one step operation.

0
On

You may be able to accomplish your goals with svn externals. The subproject would be an external to another repo.