Project

General

Profile

Using cvs2git » History » Version 3

Marc Mengel, 11/16/2012 10:02 AM

1 1 Marc Mengel
h1. Using cvs2git
2 1 Marc Mengel
3 1 Marc Mengel
p. Some users have expressed an interest in migrating their existing CVS repositories
4 1 Marc Mengel
to Git.  This wiki page will attempt to walk you through the process. 
5 1 Marc Mengel
6 1 Marc Mengel
p. There are a few steps to converting CVS modules to Git here on cdcvs: 
7 1 Marc Mengel
8 1 Marc Mengel
* Finding your existing cvs module
9 1 Marc Mengel
* checking for space requirements
10 1 Marc Mengel
* environment setup
11 1 Marc Mengel
* running cvs2git
12 2 Marc Mengel
* undumping into the repository
13 2 Marc Mengel
* cleanup
14 1 Marc Mengel
15 1 Marc Mengel
We'll go through them in detail.
16 1 Marc Mengel
17 1 Marc Mengel
h2. Finding your existing module
18 1 Marc Mengel
19 1 Marc Mengel
You need to know the $CVSROOT value for your repository for this part.  You can look in a checked-out
20 1 Marc Mengel
copy at the CVS/Root file if  you're not sure what it is.  The examples here will be as if you had a Redmine-created
21 1 Marc Mengel
repository 'myproject', which would have a $CVSROOT value of p-myproject@cdcvs.fnal.gov/cvs/projects/myproject.
22 1 Marc Mengel
23 1 Marc Mengel
You want to ssh into cdcvs using the user@cdcvs part of your $CVSROOT. 
24 1 Marc Mengel
25 2 Marc Mengel
bq. *@ssh p-myproject@@@cdcvs.fnal.gov@*
26 2 Marc Mengel
@Last login: ...@
27 1 Marc Mengel
28 2 Marc Mengel
29 1 Marc Mengel
Then change directories to the directory part of your $CVSROOT.  
30 1 Marc Mengel
31 1 Marc Mengel
32 3 Marc Mengel
p{border:1px solid black}. *@cd /cvs/projects/myproject@*
33 2 Marc Mengel
*@ls@*
34 2 Marc Mengel
@CVSROOT myproject@
35 2 Marc Mengel
36 1 Marc Mengel
h2. Check for space
37 1 Marc Mengel
38 1 Marc Mengel
There needs to be at least double the space your package takes free for the conversion.
39 1 Marc Mengel
40 3 Marc Mengel
p{border:1px solid black}.*@du -sk myproject@*
41 2 Marc Mengel
@800	myproject@
42 2 Marc Mengel
*@df -k .@*
43 2 Marc Mengel
@Filesystem           1K-blocks      Used Available Use% Mounted on@
44 2 Marc Mengel
@blue1:/cdcvs         314572800 240312928  74259872  77% /cvs@
45 1 Marc Mengel
46 2 Marc Mengel
47 1 Marc Mengel
So the Available space (the 74259872 in the above example) must be atleast double the size of the project (800 in the above example) to consider proceeding.  If it isn't, or it's within 10% or so, please put in a servicedesk ticket, and ask us to 
48 1 Marc Mengel
make grow the filesystem. 
49 1 Marc Mengel
50 1 Marc Mengel
h2. Setup your environment
51 1 Marc Mengel
52 1 Marc Mengel
You'll probably need to use the cvs 1.12 that we use behind Redmine to do the conversion, and with
53 1 Marc Mengel
our /usr/local/bin/cvs_wrap script to hide some WARNINGS it gives that cvs2git doesn't like.
54 1 Marc Mengel
55 3 Marc Mengel
p{border:1px solid black}. *@. /fnal/ups/etc/setups.sh@*
56 2 Marc Mengel
*@setup cvs v1_12_13p1@*
57 2 Marc Mengel
*@echo $CVS_DIR@*
58 2 Marc Mengel
@/fnal/ups/db/../prd/cvs/v1_12_13p1/Linux-2@
59 2 Marc Mengel
*@setup git@*
60 2 Marc Mengel
*@echo $GIT_UPS_DIR@*
61 2 Marc Mengel
@/fnal/ups/db/../prd/git/v1_6_4/Linux-2@
62 1 Marc Mengel
63 1 Marc Mengel
h2. Run the cvs2git tool
64 1 Marc Mengel
65 2 Marc Mengel
66 3 Marc Mengel
p{border:1px solid black}. *@ cvs2git \@*
67 2 Marc Mengel
*@    --blobfile=cvs2svn-tmp/git-blob.dat \@*
68 2 Marc Mengel
*@    --dumpfile=cvs2svn-tmp/git-dump.dat \@*
69 2 Marc Mengel
*@    --username=cvs2git \@*
70 2 Marc Mengel
*@    --cvs=/usr/local/bin/cvs_wrap \@*
71 2 Marc Mengel
*@    --cvs=/usr/local/bin/cvs_wrap \@*
72 2 Marc Mengel
*@  `pwd`/my-module@*
73 2 Marc Mengel
@Examining all CVS ',v' files...@
74 2 Marc Mengel
@/cvs/projects/myproject...,v@
75 2 Marc Mengel
@/cvs/projects/myproject...,v@
76 2 Marc Mengel
@...@
77 2 Marc Mengel
@Timings (seconds):@
78 2 Marc Mengel
@------------------@
79 2 Marc Mengel
@ 9.43   pass1    CollectRevsPass@
80 2 Marc Mengel
@ 0.03   pass2    CleanMetadataPass@
81 2 Marc Mengel
@ 0.01   pass3    CollateSymbolsPass@
82 2 Marc Mengel
@...@
83 1 Marc Mengel
@10.05   total@
84 1 Marc Mengel
85 1 Marc Mengel
Then actually setup the git repository, and pull in the dump that cvs2git made
86 1 Marc Mengel
87 3 Marc Mengel
p{border:1px solid black}. *@ mkdir myproject.git@*
88 3 Marc Mengel
*@ cd myproject.git@*
89 3 Marc Mengel
*@ git init --bare --shared@*
90 3 Marc Mengel
*@ git update-server-info@*
91 3 Marc Mengel
*@ cat ../cvs2svn-tmp/git-blob.dat ../cvs2svn-tmp/git-dump.dat | git fast-import@*
92 3 Marc Mengel
*@ git gc --prune=now@*
93 1 Marc Mengel
94 1 Marc Mengel
h2. Clean up
95 1 Marc Mengel
96 3 Marc Mengel
p{border:1px solid black}. *@ cd .. @*
97 3 Marc Mengel
*@ rm -rf cvs2svn-tmp @*