In which I move my version control from ComponentSoftwareâ€™s CS-RCS Pro to Git while preserving commit history.
[If you donâ€™t want the back story, click here for the instructions!]
OK, so having watched the video I linked to earlier, I thought Iâ€™d move some of my old projects to Git.
I picked one at random, and went looking for tools.
Iâ€™m hampered a little by the fact that all my old projects used ComponentSoftwareâ€™s â€śCS-RCS Proâ€ť.
A couple of really good reasons:
But you know who doesnâ€™t use CS-RCS Pro any more?
Thatâ€™s right, ComponentSoftware.
Itâ€™s a dead platform, unsupported, unpatched, and belongs off my systems.
One simple reason â€“ if I move off the platform, I face the usual choice when migrating from one version control system to another:
The second option seems a bit of a waste to me.
OK, so yes, technically I could mix the two modes, by using CS-RCS Pro to browse the ancient history when I need to, and Git to browse recent history, after starting Git from a clean working folder. But I could see a couple of problems:
So, really, I wanted to make sure that I could move my files, history and all.
I really didnâ€™t have a good way to do it.
Clearly, any version control system can be moved to any other version control system by the simple expedient of:
But, as you can imagine, thatâ€™s really long-winded and manual. That should be automatable.
In fact, given the shared APIs of VSS-compatible source control services, Iâ€™m truly surprised that nobody has yet written a tool to do basically this task. Iâ€™d get on it myself, but I have other things to do. Maybe someone will write a â€śVSS2Gitâ€ť or â€śVSS2VSSâ€ť toolkit to do just this.
There is a format for creating a single-file copy of a Git repository, which Git can process using the command â€śgit fast-importâ€ť. So all I have to find is a tool that goes from a CS-RCS repository to the fast-import file format.
So, clearly thereâ€™s no tool to go from CS-RCS Pro to Git. Thereâ€™s a tool to go from CS-RCS Pro to CVS, or there was, but that was on the now-defunct CS-RCS web site.
Butâ€¦ Remember I said that itâ€™s compatible with GNU RCS.
And thereâ€™s scripts to go from GNU RCS to Git.
OK, so the script for this is written in Ruby, and as I read it, there seemed to be a few things that made it look like it might be for Linux only.
I really wasnâ€™t interested in making a Linux VM (easy though that may be) just so I could convert my data.
Everything changed with the arrival of the recent Windows 10 Anniversary Update, because along with it came a new component.
Bash on Ubuntu on Windows.
Itâ€™s like a Linux VM, without needing a VM, without having to install Linux, and it works really well.
With this, I could get all the tools I needed â€“ GNU RCS, in case I needed it; Ruby; Git command line â€“ and then I could try this out for myself.
Of course, I wouldnâ€™t be publishing this if it wasnâ€™t somewhat successful. But there are some caveats, OK?
Iâ€™ve tried this a few times, on ONE of my own projects. This isnâ€™t robustly tested, so if something goes all wrong, please by all means share, and people who are interested (maybe me) will probably offer suggestions, some of them useful. Iâ€™m not remotely warrantying this or suggesting itâ€™s perfect. It may wipe your development history out of your one and only copy of version controlâ€¦ so donâ€™t do it on your one and only copy. Make a backup first.
GNU RCS likes to store files in one of two places â€“ either in the same directory as the working files, but with a â€ś,vâ€ť pseudo-extension added to the filename, or in a sub-directory off each working folder, called â€śRCSâ€ť and with the same â€ś,vâ€ť extension on the files. If you did either of these things, thereâ€™s no surprises. Butâ€¦
CS-RCS Pro doesnâ€™t do this. It has a separate RCS Repository Root. I put mine in C:\RCS, but you may have yours somewhere else. Underneath that RCS Repository Root is a full tree of the drives youâ€™ve used CS-RCS to store (without the â€ś:â€ť), and a tree under that. I really hope you didnâ€™t embed anything too deep, because that might bode ill.
Initially, this seemed like a bad thing, but because you donâ€™t actually need the working files for this task, you can pretend that the RCS Repository is actually your working space.
Maybe this is obvious, but it took me a moment of thinking to decide I didnâ€™t have to move files into RCS sub-folders of my working directories.
Make this a â€śflag dayâ€ť. After you do this conversion, never use CS-RCS Pro again. It was good, and it did the job, and itâ€™s now buried in the garden next to Old Yeller. Do not sprinkle the zombification water on that hallowed ground to revive it.
This also means you MUST check in all your code before converting, because checking it in afterwards will be â€¦ difficult.
Assumption: You have Windows 10.
This might look like a lot of instructions, but I mostly just wanted to be clear. This is really quick work. If you screw up after the â€śgit initâ€ť command, simply â€śrm â€“rf .gitâ€ť to remove the new repository.