Migrating cvs repositories from Linux to FreeBSD

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Jun 23 09:45:15 PDT 2004


On 2004-06-23 10:03, Dan Nelson <dnelson at allantgroup.com> wrote:
> In the last episode (Jun 22), login at istop.com said:
> > I got two hosts with the following specs:
> >
> > The oldhost is running Mandrake Linux 8.2 version 2.4.18-6mdk
> > and newhost is running FreeBSD 5.2.1-RELEASE.
> > [...]
> > Now only concern is how to migrate or move the cvs repositories from
> > the oldhost [Linux] to newhost [FreeBSD].
> >
> > Is this a valid sequence? Am I missing any point? Would there be
> > inconsitency as the cvs version are not same on these hosts?
>
> That should work fine.  CVS has always used the same repository format
> so version differences shouldn't matter.

As a real world example of what can be done with CVS repository files,
here's a story of mine from a few days ago.

While at work, I started working on a local version of a program, say
`foobar', whose version control files were stored in `$CVSROOT/foobar'.

Locally, at the machine where the CVSROOT lived, I made a lot of changes
to the files.  The workstation I used runs Fedora Core/2.  I saved a
tarball of all the files in `$CVSROOT/foobar' and copied it to a remote
machine that runs FreeBSD.  Untarred the `foobar.tgz' tarball straight
into my new CVSROOT and checked it out like a charm :)

I know that this is not the right method of mirroring CVS repositories.
I'm the only person working on those files though and I only make
changes in one of the two CVS trees.  The other one is used as an
anoncvs access server.

So, what you're describing *does* work.

> > The steps, I think, may be involve to accomplish this task are:
> >
> > 1. make identical user accounts on newhost as oldhost ones
> > 2. announce to users and  stop the cvs server on oldhost
> > 3. on oldhost, backup the CVSROOT
> > 4. on newhost, restore the CVSROOT
> > 5. start the cvs server on newhost
> > 6. point the users to start using newhost for checkin/checkout stuff

That seems fine.  You can even insert a couple of rsync's among the
steps and let your users work uninterrupted while you're copying the
CVS tree.  Then announce that they have to switch their CVSROOT.

If anyone has checked out files that he hasn't committed, they can use
this small script on any checked out tree to change it's CVS/Root files
to point to the new CVSROOT:

    #!/bin/sh

    newroot="$1"
    if [ X"${newroot}" = X"" ]; then
	echo "usage: cvsroot <newroot>" 1>&2
	exit 1
    fi

    find . -type d -name CVS -print0 | \
    xargs -0 -n 1 -I % echo '"%"' | \
    sed -e 's:"$:/Root":' |\
    xargs sed -i '' -e 's!^.*$!'"${newroot}"'!'

The last command, which uses the -i option of sed(1) works on FreeBSD
but needs a bit of tinkering if you plan to use it with GNU sed(1) on
Linux.

HTH,

- Giorgos




More information about the freebsd-questions mailing list