Experiences changing version control systems with a large codebase

Status
Not open for further replies.

rationull

Ars Scholae Palatinae
677
Subscriptor++
My team at work (a software department of ~10 developers) has been using CVS for version control since the dawn of time (or at least since the department started up in its current form). While I am something of a pragmatist and CVS does technically "work", it's pretty bad in many ways and myself along with the rest of the team have been ready for a change for some time. Since we don't have a dedicated build or software infrastructure team, progress toward the change has been slow, but we've pretty much settled on Mercurial for a variety of reasons that I don't need to go into here.

I'm not in a position where I'm directly responsible for setting up or maintaining our revision control system, but I am in a position where I have strong influence over what we do with respect to it. One of the things that's been holding us up is a supposedly immature tool set for converting a repository between CVS and Mercurial. Note that I personally haven't done any research in this area and I'm not sure about the details -- that's not my job. My boss has been holding pretty high standards here (which is good, to start). Ideally we'd use a conversion that would maintain all existing history, branches, and tags, and really we'd like to have a bidirectional setup so that we can easily fall back if necessary. However I'm starting to wonder whether all or part of this (our conversion requirements) are just a pipe dream. I'm even wondering if we'd be better off biting the bullet and switching over clean without carrying over our ~10 year history (and keep the CVS server running read only for archival checkouts and history spelunking, of course).

I think what I'm looking for here is anecdotes or advice from people who've been through large revision control transitions, whether just as users/developers or in more administrative roles. We've used CVS pretty fully, with plenty of tags and branches. I've done a fair amount of branch maintenance here over the years and it can be a bit of a nightmare, especially with CVS. I'm really looking forward to having a better system but at the same time I'm wondering if having a crufty old history from CVS is going to end up making life easier in the short term, but just polluting the repository with a bunch of weird history in the long term.
 

MilleniX

Ars Tribunus Angusticlavius
8,139
Subscriptor++
I was in charge of migrating a 500,000 line codebase with 15 years of history from CVS to Git. Here are my thoughts on what you're in for:
  • You really want to preserve history: the history browsing tools in the modern DVCS are far better than those in CVS. Leaving the history behind means losing essentially all of the value those can offer.
  • The conversion tools are rough around the edges, but that's not actually a problem. The key is to treat the repository conversion as a iterative series of attempts, in which you run the tools with as much configuration as you've figured out, see what went right or wrong, fix stuff, and try again. After each attempt, browse through the history and look at what's there. Eventually, the primary person doing the migration will be satisfied, and then it's time for someone else to clone and look.
  • One way to test that things are working right is to check out at select points from both the old and new repositories, run the build process, and see if the results are identical.
  • Take this as an opportunity to clean up nasty mistakes in your existing history. For example, some executable was checked in by mistake? Filter it out during the conversion. This sort of thing is somewhat important, because every future clone will carry a copy of the history, including that cruft.
  • I used git-cvsimport, which depends on cvsps (a utility that bundles up patch sets from CVS logs). I had to get a development version of cvsps, rather than using its last release (from quite a while earlier). It would be good to look at the different tools on offer, and see what advantages and disadvantages people cite for each.

Phil
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
We went cvs to svn and it was pretty trivial. (Huge code base - few million lines across a few repos).
Can't remember the cvs -> svn converter used but I think it was cvs2svn provided by CollabNet.

This included conversion of multiple checkin into change sets (which worked surprisingly well, even across the older history converted from the VSS days)

Thus one option is to do a conversion to svn, then use the mercurial tools to convert from svn to hg (which should be very well used and stable) rather than the cvs -> mercurial direct which may not have the same level of scrutiny/use.

Definitely pull your history, it's the single most valuable thing your source control contains.

The advice would be to:

Test a conversion onto a dev repo server.
Update your build system so it can support both source control systems (and verify it works on the test copy)
Make sure everyone is using the new build system / has the relevant ools present on their machines.
Agree a day where for a few hours your repo will go read only.
On that day lock your repo, do the conversion, bring the new repo online (also locked)
Check everyone can build is happy.
Unlock the new repo.
???
Profit?

If your using a DVCS then the 'lock' phase may be a moot point (but you should be able to lock out changes to the master. This just lets you have a pleasant 'oh crap it's all gone wrong' rollback scenario.
 

rationull

Ars Scholae Palatinae
677
Subscriptor++
Great input, thanks. I'm glad you all are suggesting not to ditch the history. We really don't want to -- but we can be admin deficient sometimes (really just strapped for time) so I'd started wondering about it. Speaking of history being valuable, I'm really looking forward to using a DVCS and not losing some nuanced history whenever we do a big merge between branches. It'll make tracking a change back through time so much nicer...

I hadn't thought about going CVS->SVN->hg but now that you mention it, the guy who's actually doing the conversion might've mentioned that at some point. We're using plain old CVS, not CVSNT. I think the conversion tools from CVS->hg are somewhat well supported but I'm really not all that personally familiar with the situation. I remember we were having trouble with EOLs at some point (it's a Windows codebase so we use Windows line endings everywhere) but I think that was at least mostly resolved by an hg extension.

I like the iterative conversion approach. I also like the idea of cleaning up errant large checkins and stuff. I've been a little concerned with the potential size of the repository and its clones and I'm not sure what we're going to do about the binaries we currently track in CVS (CVS sucks for binaries too, of course, but the impact is much smaller than it will be in a DVCS).

MilleniX: Very helpful post. Sounds like your situation was fairly similar to ours: moving from CVS to a DVCS (from what I understand Git and hg are pretty similar). Our codebase is somewhere on the order of 750,000 last I checked and with about 10 years of history on it.
 

MilleniX

Ars Tribunus Angusticlavius
8,139
Subscriptor++
Oh, I just remembered another important point that I didn't mention earlier. Consider carefully what your repository boundaries should be. Just because everything's in one big CVS repository right now, doesn't mean it should be a big repository in Mercurial or Git. If you have components that evolve independently, they should probably go into separate repositories.
 

rationull

Ars Scholae Palatinae
677
Subscriptor++
MilleniX":3agyca7s said:
Oh, I just remembered another important point that I didn't mention earlier. Consider carefully what your repository boundaries should be. Just because everything's in one big CVS repository right now, doesn't mean it should be a big repository in Mercurial or Git. If you have components that evolve independently, they should probably go into separate repositories.

We try not to have things evolve too independently. We don't have licensing constraints with respect to what code gets delivered to what clients since we're not a contracting company and we don't serve multiple client companies. I think the current plan is to go with one big repository but I'm not sure how well that's going to work out due to size.

Thinking about that (and also how to handle branching under hg) is definitely on the radar though.
 
Status
Not open for further replies.