Contents

  1. Introduction
  2. Download current source
  3. Symbiosis
    1. .cvsignore
    2. .gitignore
  4. Initial import of NetBSD CVS source repository
  5. Keeping the git repository uptodate with CVS
  6. Done
  7. References

Introduction

The purpose of this document is to guide you on how to track NetBSD CVS source repository with git. We are going to make a "bulk import" and by this is meant that not all the CVS checkins with comments are going to be imported. If we wanted so, we would use the git-cvsimport(1) tool.

Download current source

To begin with, we must have a current CVS snapshot of the NetBSD source tree. I assume you already have one in /usr/src-git. If not, please consult this article in the official NetBSD documentation page.

Symbiosis

Since both CVS and Git are going to live together inside the same directory, it is essential to hide each one from the other. That is because we don't want CVS to track git files or vice versa. For this purpose we need two files inside the root directory of our source tree.

.cvsignore

Create a file named .cvsignore inside /usr/src-git and put the following lines in it:

.git/
.gitignore

.gitignore

Create a file named .gitignore inside /usr/src-git and put the following lines in it:

CVS/
.cvsignore

Initial import of NetBSD CVS source repository

# cd /usr/src-git
# git init
Initialized empty Git repository in /usr/src-git/.git/
# git add .
# git commit -m "Initial import of the NetBSD CVS source repository"

Keeping the git repository uptodate with CVS

From time to time, we update the main git repository with the latest changes from CVS.

# cvs update -dPA
# git add .
# git commit -a -m "Update to latest CVS snapshot"

Done

You can examine the log:

# cd /usr/src-git
# git log
commit 9fe7a0469a8ef58fd5b484c0931808a2d23f559e
Author: Charlie <root@netbsd.(none)>
Date:   Mon Nov 24 01:17:31 2008 +0200

    Update to latest CVS snapshot

commit 78189d3fa331073021eaea88d1f51f3487d756b7
Author: Charlie <root@netbsd.(none)>
Date:   Mon Nov 24 00:59:47 2008 +0200

    Initial import of the NetBSD CVS source repository
#

Or create a crazy branch to work on, offline, without being embarassed if it ends up as a dead end.

# cd /usr/src-git
# git branch
* master
# git checkout -b crazy-branch
Switched to a new branch "crazy-branch"
# git branch -a
* crazy-branch
  master
#

References

Using git to track firefox cvs