Project

General

Profile

Using cvs2git » History » Version 7

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