気ままなつぶやき

おべんきょしたこととか

How to switch over from CVS to Git.

Document is here. →cvs2svn: cvs2git Documentation

Requires..

U can see ... from this link.
cvs2svn: cvs2git Documentation

  • U can connect to CVS repo directly..( that is ... U execute on CVS sever...I think)
  • Python version 2.4 or later
  • git version 1.5.4.4 or later
  • others...(If U want to use --use-rcs option, U need co programing. And If --use-cvs option, cvs command is required.)

Hmm....〆(._.)memo.

#python :)
$python -V
Python 2.4.3
#git :)
$git --version
git version 1.7.11.3
#CVS :)
$cvs --v
Concurrent Versions System (CVS) 1.11.22 (client/server)
ry)
$svn --version
svn, バージョン 1.7.4 (r1295709)

Hmm,,,, It's probably ok(○゚ε゚○)

So many VCS ....git ,,,,cvs,,,,svn.....

get cvs2git

I did checkout from tigris's subversion repo, not download from download page.

$mkdir cvs2gitwork
$cd cvs2gitwork/
$svn co --username=guest --password="" http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
$ls
cvs2svn-trunk
$cd cvs2svn-trunk/
$ ls -l cvs2git 
-rwxr-xr-x 1 root root 2466  326 21:56 cvs2git

SWITCH OVER CVS to GIT

At first, stop cron backup jobs.

I did on CVS server.

$ cd /tmp
$ mkdir workcvs2git
$ cd workcvs2git

execute cvs2git command

I found "imai" project, probably created by Mr. Imai in my company.
So I used project for trial.

$ cvs2git  --encoding=utf_8 --encoding=shift_jis --blobfile=/tmp/workcvs2git/testblob.dat --dumpfile=/tmp/workcvs2git/testdump.dat --username=pnsk /usr/local/cvsrepo/imai

The statistics information is displayed as below and cvs2git job is completed.

cvs2svn Statistics:
------------------
Total CVS Files:                97
Total CVS Revisions:           104
Total CVS Branches:              0
Total CVS Tags:                  0
Total Unique Tags:               0
Total Unique Branches:           0
CVS Repos Size in KB:        18039
Total SVN Commits:               9
First Revision Date:    Mon Sep 10 18:37:06 2007
Last Revision Date:     Sat Nov 24 20:34:02 2007
------------------
Timings (seconds):
------------------
0.940   pass1    CollectRevsPass
0.007   pass2    CleanMetadataPass
0.004   pass3    CollateSymbolsPass
0.023   pass4    FilterSymbolsPass
0.014   pass5    SortRevisionSummaryPass
0.011   pass6    SortSymbolSummaryPass
0.018   pass7    InitializeChangesetsPass
0.012   pass8    BreakRevisionChangesetCyclesPass
0.012   pass9    RevisionTopologicalSortPass
0.006   pass10   BreakSymbolChangesetCyclesPass
0.011   pass11   BreakAllChangesetCyclesPass
0.011   pass12   TopologicalSortPass
0.023   pass13   CreateRevsPass
0.008   pass14   SortSymbolsPass
0.007   pass15   IndexSymbolsPass
0.017   pass16   OutputPass
1.123   total

Maybe I saw keyword "cvs2svn",,,,??? ( ゚д゚)
It's my imagination..(つд⊂)

create git repo

f:id:pnsk:20130329141523p:plain

U select "public" or "private", and NOT check "Initialize this repository with a README"

$ git clone git@xxx.xxx.xxx.xxx:pnsk/imai.git

Hmm,,, import dump files into git repo.

$cd imai

$cat /tmp/workcvs2git/testblob.dat /tmp/workcvs2git/testdump.dat  | /usr/local/git/bin/git fast-import

git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:       5000
Total objects:          170 (         1 duplicates                  )
      blobs  :          103 (         1 duplicates         55 deltas)
      trees  :           59 (         0 duplicates         21 deltas)
      commits:            8 (         0 duplicates          0 deltas)
      tags   :            0 (         0 duplicates          0 deltas)
Total branches:           1 (         1 loads     )
      marks:     1073741824 (       112 unique    )
      atoms:            117
Memory total:          2344 KiB
       pools:          2110 KiB
     objects:           234 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 8589934592
pack_report: pack_used_ctr            =          9
pack_report: pack_mmap_calls          =          2
pack_report: pack_open_windows        =          2 /          2
pack_report: pack_mapped              =   13318273 /   13318273
---------------------------------------------------------------------

push to GitHubEnterprise

#push!!!
$git push -u origin master
Counting objects: 170, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (73/73), done.
Writing objects: 100% (170/170), 12.70 MiB | 22.36 MiB/s, done.
Total 170 (delta 76), reused 170 (delta 76)
To git@xxx.xxx.xxx.xxx:pnsk/imai.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Tips

NOT check "Initialize this repository with a README"

If U checked, when U execute following command

$cat /tmp/workcvs2git/testblob.dat /tmp/workcvs2git/testdump.dat  | /usr/local/git/bin/git fast-import

warning messages will be displayed as below.
warning: Not updating refs/heads/master

That is, Repo need empty.

encoding

When U execute cvs2git, if encoding options are insufficient,

error messages will be display..

ERROR: There were warnings converting author names and/or log messages
to Unicode (see messages above).  Please restart this pass
with one or more '--encoding' parameters or with
'--fallback-encoding'.

U have to add encoding options U need.

$cvs2git  --encoding=utf_8 --encoding=shift_jis  .....

Encoding lists is as follows.
7.8. codecs — Codec registry and base classes — Python v2.7.5 documentation

push tags and branches

$/usr/local/git/bin/git push --all origin
$/usr/local/git/bin/git push --tags origin