none
[openafs-wiki.git] / AFSLore / OpenAFSCVSToGitConversion.mdwn
1 # <a name="Git Plan:"></a> Git Plan:
2
3 This is the procedure used to convert the [[OpenAFS]] CVS version control into a git repository. This work was done by Maximilian Cohan and Michael Meffie at the [[OpenAFS]] hackaton 2008 at Google, based of the work already done by Derrick Brashear.
4
5 ## <a name="Background"></a> Background
6
7 The [[OpenAFS]] cvs repository poses several unique and interesting challenges in the git conversion. A custom tool called wdelta, combined with a custom set of commit scripts, has been used since the projects inception. The deltas are effectively patch sets made up of rcs revisions. We need to preserve these deltas and all the history associated with the deltas. Unfortuntunately, the not all deltas were created automically. This leads to some issues,
8
9 - There are cases where the same file has been changed more than once in a given delta.
10 - In those cases, the revisions of a given file in a given delta is not always consective.
11 - In the cases where there are revision gaps, there could be conflicts when trying to collapse the changes into a single patch for the file.
12 - Also in the cases where there are gaps, it is possible that cvs tags could interleave the revisions of a delta, although it is unknown at this time if such a case exists.
13
14 ## <a name="Overview of the process"></a> Overview of the process
15
16 ## <a name="Set up base Repo"></a> Set up base Repo
17
18 ### <a name="Prep:"></a> Prep:
19
20 ### <a name="Process:"></a> Process:
21
22 #### <a name="(commit 1) Start from IBM 1.0 +"></a><a name="(commit 1) Start from IBM 1.0 + "></a> (commit 1) Start from IBM 1.0 + 3.6 docs
23
24 [
25
26 - (in a tmp directory) cvs -d:pserver:anonymous@cvs.openafs.org:/cvs -z5 export -ropenafs-stable-1\_1\_0 openafs/doc
27 - Make and change to git\_base directory
28 - untar openafs-1.0-src.tar.gz
29 - move tmp ´doc´ folder into git\_base
30 - untar initial-commit-postapply.tar
31 - git init
32 - git add .
33 - git commit -m "Initial IBM source code import\\rDelta initial-20001103" --author="Transarc &lt;afs@transarc.com&gt;"
34
35 ]
36
37 #### <a name="(commit 2) Apply license changes"></a> (commit 2) Apply license changes
38
39 [
40
41 - Apply 2.patch
42 - Cleanup: rm .rej &amp; .orig
43 - untar 2-postapply.tar
44 - git commit -m "" --author="Transarc &lt;afs@transarc.com&gt;"
45
46 ]
47
48 ### <a name="Patch Fixup"></a> Patch Fixup
49
50 - Original codebase had bit errors; tarball used for git base does not have them, remove (most of) these fixes from patchsets
51
52 ]
53
54 ### <a name="Repo Fixup"></a> Repo Fixup
55
56 [
57
58 - Resolve issues into commit 3
59   - Part of the doc tree was not in the initial import
60   - README files were missing
61   - IBM tree has munged tags; cvsps output does not...
62     - Check in IBM tree to CVS, export -kk and use resulting diff -R to make all Revisions in the tree unmunged
63 - Store commit 3 diff
64 - Stash commit 2
65 - Reset to commit 1
66 - Apply commit 3 diff
67 - Amend commit 1
68 - Reapply commit 2
69
70 ]
71
72 ### <a name="Issues:"></a> Issues:
73
74 license changes won´t apply cleanly as initial was from RCS and CVS munged rev vars on checkout
75
76 ## <a name="Automate patch - branches"></a> Automate patch -&gt; branches
77
78 ### <a name="Prep:"></a> Prep:
79
80 ### <a name="Process:"></a> Process:
81
82 - Clone base repo (git clone git\_base git\_working)
83 - Starting with 3.patch
84 - Loop:
85   - Create branch with patch/delta name (git checkout -b)
86   - Apply patch (git apply --index)
87   - Commit (-m ´Apply patch X´)
88
89 ### <a name="Issues:"></a> Issues:
90
91 ## <a name="Handle binaries"></a> Handle binaries
92
93 ### <a name="Prep:"></a> Prep:
94
95 - Find a list of binaries in cvs, search for '^expand\\w+@b|o@'
96
97 ### <a name="Process:"></a> Process:
98
99 - Loop:
100   - For patch X
101   - Parse file list from patch X
102   - If patch has binary files, git check out branch X
103   - For each binary file, CVS check out listed revision over existing file
104   - Commit (-m ´Adding binaries´)
105
106 ## <a name="Merge branches into master branc"></a> Merge branches into master branch
107
108 ### <a name="Prep:"></a> Prep:
109
110 - Parse patches to make X.msg &amp; X.author
111
112 ### <a name="Process:"></a> Process:
113
114 - Loop:
115   - Merge branch X into master (git merge --squash)
116   - Commit with message &amp; author for patch X (git commit)
117   - ! On failure... stop, and allow for reset
118 - Push master to origin/master
119
120 ## <a name="Validate and release"></a> Validate and release
121
122 - Check that checkout of master matches cvs HEAD
123
124 ## <a name="Handle tags"></a> Handle tags
125
126 - Determine tag-&gt;delta relationship
127
128 -- [[MichaelMeffie]] - 28 Oct 2008