Skip to content

Instantly share code, notes, and snippets.

@nsapa
Last active April 19, 2022 01:15
Show Gist options
  • Save nsapa/1f4d4009a566d3d9c7ed19ffe5057159 to your computer and use it in GitHub Desktop.
Save nsapa/1f4d4009a566d3d9c7ed19ffe5057159 to your computer and use it in GitHub Desktop.
cvs to git for github

(Inspired from Sourceforge' CVS convertion documentation)

We are using pearpc as example:

  • List all CVS module by going to the CVS page (ie: pearpc,utils,www) : http://pearpc.cvs.sourceforge.net/
  • Install the required software: dnf install coreutils sed cvs rcs rsync curl git git-cvs
  • Get the whole CVSroot: rsync -a a.cvs.sourceforge.net::cvsroot/pearpc/ pearpc_cvs
  • Export the list of every authors: for vfile in `find pearpc_cvs -name '*,v'`; do rlog $vfile | sed -nr 's/^date:.* author: ([^;]+).*/\1/p'; done | sort -u >cvs-author-names
  • Cleanup cvs-author-names by removing root
  • Generate the mapping file: for uname in `cat cvs-author-names`; do json=`curl https://sourceforge.net/rest/u/$uname/profile`; fname=`echo "$json" | sed -nr 's/\{"username": "[^"]+", "name": "([^"]+)".*/\1/p'`; echo "$uname = $fname <$uname@users.sourceforge.net>"; done >authors.txt
  • Fix the mapping file authors.txt (correct corrupted charset, set the correct email, ...)
  • For every module (here for pearpc):
    • Convert the cvs module to a new git repositery: git cvsimport -v -a -k -d `pwd`/pearpc_cvs -C pearpc_git_pearpc -A authors.txt pearpc
    • Move into your newly create git repositery: cd pearpc_git_pearpc
    • Add a new remote called origin: git remote add origin https://scm.byme.at/Converted/pearpc_cvs_pearpc.git
    • Push the master branch: git push -u origin master
    • Push everything else (tags, other branch): git push --all origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment