File:  [NetBSD Developer Wiki] / wikisrc / tutorials / using_git_to_track_netbsd_cvs_source_repository.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Fri Nov 25 00:19:18 2011 UTC (2 years, 4 months ago) by mspo
Branches: MAIN
CVS tags: HEAD
a few more files that I missed in my big import

**Contents**

[[!toc levels=3]]

#  Introduction

The purpose of this document is to guide you on how to track NetBSD CVS source repository with [git][12]. 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)][13] tool. 

   [12]: http://git.or.cz/ (http://git.or.cz/)
   [13]: http://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html (http://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html)

#  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][14] in the official NetBSD documentation page. 

   [14]: http://www.netbsd.org/docs/current/#downloading (http://www.netbsd.org/docs/current/#downloading)

#  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 line 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][15]

   [15]: http://www.bluishcoder.co.nz/2007/06/using-git-to-track-firefox-cvs.html (http://www.bluishcoder.co.nz/2007/06/using-git-to-track-firefox-cvs.html)


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb