We are currently at the very start of our DevOps journey, gradually transitioning from legacy development tools, into more modern, platform-independent tools. One of my clients is using the ancient source control system ‘CVS’, and because I want to implement a CI pipeline we had to convert all of our CVS repositories into git repos.
It’s not easy to convince dev people to throw away what they know and start using new tools, no matter how good you explain the benefits. The old statement “Why replace something that’s not broken?” will almost always win any argument. Eventually I was able to persuade the right people.
So if you have a bunch of CVS repositories you want to get rid of, and you like GitLab, checkout this bash script I’ve wrote to convert each CVS directory into a bare git repo, and then push that repo into GitLab.
What’s neat about this script is that it uses GitLab API to programatically create each repo with custom visibility settings (‘Internal Project’) so that developers can get on board quickly. Consider running the ‘Add all users to all projects’ rake task to add all GitLab users to the newly created repos (careful with this, it does not destinguish between imported repos and old repos)
$ gitlab-rake gitlab:import:all_users_to_all_projects
Here are the instructions:
- Install cvs2svn & cvs (you can find links below)
- cd into the directory holding all your CVS repositories (Where CVSROOT is located)
- Create folders “output/git_tmp” in the current folder
- Change parameters in cvs2git.sh to match your environment
chmod +x cvs2git.sh
And here is the code: