# Git Plan: 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. ## Background 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, - There are cases where the same file has been changed more than once in a given delta. - In those cases, the revisions of a given file in a given delta is not always consective. - 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. - 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. ## Overview of the process ## Set up base Repo ### Prep: ### Process: #### (commit 1) Start from IBM 1.0 + 3.6 docs [ - (in a tmp directory) cvs -d:pserver:anonymous@cvs.openafs.org:/cvs -z5 export -ropenafs-stable-1\_1\_0 openafs/doc - Make and change to git\_base directory - untar openafs-1.0-src.tar.gz - move tmp ´doc´ folder into git\_base - untar initial-commit-postapply.tar - git init - git add . - git commit -m "Initial IBM source code import\\rDelta initial-20001103" --author="Transarc <afs@transarc.com>" ] #### (commit 2) Apply license changes [ - Apply 2.patch - Cleanup: rm .rej & .orig - untar 2-postapply.tar - git commit -m "" --author="Transarc <afs@transarc.com>" ] ### Patch Fixup - Original codebase had bit errors; tarball used for git base does not have them, remove (most of) these fixes from patchsets ] ### Repo Fixup [ - Resolve issues into commit 3 - Part of the doc tree was not in the initial import - README files were missing - IBM tree has munged tags; cvsps output does not... - Check in IBM tree to CVS, export -kk and use resulting diff -R to make all Revisions in the tree unmunged - Store commit 3 diff - Stash commit 2 - Reset to commit 1 - Apply commit 3 diff - Amend commit 1 - Reapply commit 2 ] ### Issues: license changes won´t apply cleanly as initial was from RCS and CVS munged rev vars on checkout ## Automate patch -> branches ### Prep: ### Process: - Clone base repo (git clone git\_base git\_working) - Starting with 3.patch - Loop: - Create branch with patch/delta name (git checkout -b) - Apply patch (git apply --index) - Commit (-m ´Apply patch X´) ### Issues: ## Handle binaries ### Prep: - Find a list of binaries in cvs, search for '^expand\\w+@b|o@' ### Process: - Loop: - For patch X - Parse file list from patch X - If patch has binary files, git check out branch X - For each binary file, CVS check out listed revision over existing file - Commit (-m ´Adding binaries´) ## Merge branches into master branch ### Prep: - Parse patches to make X.msg & X.author ### Process: - Loop: - Merge branch X into master (git merge --squash) - Commit with message & author for patch X (git commit) - ! On failure... stop, and allow for reset - Push master to origin/master ## Validate and release - Check that checkout of master matches cvs HEAD ## Handle tags - Determine tag->delta relationship -- [[MichaelMeffie]] - 28 Oct 2008