2010年4月26日 星期一

git-cvs

Initialization
git cvsimport -v -d <CVSROOT> -C <destination> <cvs_module>
git cvsimport -v -d :pserver:anonymous@rstplib.cvs.sourceforge.net:/cvsroot/rstplib -C rstplib rstplib

(<cvs_module> is in fact the directory structure in the CVSROOT)

Configuration Tweaks
mkdir .git/refs/remotes/<remote> -p; cp .git/refs/heads/* .git/refs/remotes/<remote> -a;
git config cvsimport.module <cvs_module>
git config cvsimport.r <remote>
git config cvsimport.d <CVSROOT>

(<remote>: mean remote branch on this git repository, just like the branch "orign" to "git clone" or the branch "git-svn" to "git svn", just cvsimport doesn't do it for you. "cvs" or "git-cvs" is good)
(what if there are new branch on cvs server?)

Incremental Imports/Update repository to the latest
In root directory of git repository and on master branch. With above git config,

git cvsimport

or run the original command again but omit the parameter -C
git cvsimport -r <remote> -d <CVSROOT> <cvs_module>




1. cd ../myproj
2. cvs up -d
3. for i in `GIT_DIR=../git-piscine-j01/.git git-cherry origin work | sed -n 's/^+ //p'`; do echo Exporting $i; GIT_DIR=../git-piscine-j01/.git git-cvsexportcommit -c -p -v $i || break; done
4. cvs diff -u
5. git-cvsimport -v -C ../git-myproj -a
6. cd ../git-myproj
7. git checkout origin
8. git merge master
9. git checkout master


- - - update-git.sh - - -
git-cvsimport -v -C ../git-project
cd ../git-project
git checkout master
git merge origin

- - - export-commits.sh - - -
for i in `GIT_DIR=../git-project/.git git-cherry origin master | sed -n 's/^+ //p'`; do echo Exporting $i; GIT_DIR=../git-project/.git git-cvsexportcommit -c -p -v $i || break; done



git for CVS users
http://kernel.org/pub/software/scm/git/docs/v1.4.4.4/cvs-migration.html

Git CVS tutorial
http://dabase.com/e/09017/

CVS to GIT and back
http://issaris.blogspot.com/2005/11/cvs-to-git-and-back.html

使用 git 來 mirror CVS repository
http://cyt93cs.pixnet.net/blog/post/26629828

How to export revision history from mercurial or git to cvs?
http://stackoverflow.com/questions/584522/how-to-export-revision-history-from-mercurial-or-git-to-cvs/584567

沒有留言: