export CVSEDITOR=vim
export CVSROOT=":pserver:kropf@sourcehost.i.echoworx.com:/cvsroot"

function cvs-git-import {
   if [ $# -ne 2 ]; then
      echo "usage: cvs-git-import [dir] [module]"
      return
   fi
   
   dir=$1
   module=$2
   
   git cvsimport -d ${CVSROOT} -C ${dir} -r cvs -k ${module}
   cd ${dir}
   
   git config cvsimport.module ${module}
   #git config cvsimport.r cvs
   git config cvsimport.d ${CVSROOT}
   
   cvs checkout -d upstream ${module}
}

function cvs-git-update {
   if [ ! -d ".git" ]; then
      echo "not a git repo: can't find .git directory"
      return
   fi
   
   git cvsimport -r cvs
}

function cvs-git-commit {
   cvs-git-update
   
   if [ $# -eq 1 ]; then
      #msg=$(gxmessage -center -geometry 500x100 -entry -title "enter commit message" "enter commit message") || return
      echo "enter message for CVS commit"
      read msg
      
      if [ -n "${msg}" ]; then
         echo "empty commit message: abort"
      fi
      
      git merge --no-ff -m "${msg}" --log $1 || return
   fi
   
   git cvsexportcommit -w upstream -u -p -c ORIG_HEAD HEAD
}

function cvs-git-help {
   echo "http://stackoverflow.com/questions/584522/how-to-export-revision-history-from-mercurial-or-git-to-cvs/586225#586225

Use cvs-git-import to checkout a project from CVS. Set CVSROOT first.

Make changes in a topic branch, never the master branch.

When ready to commit switch to master branch and use cvs-git-commit to merge
branch and commit to cvs."
}