Reputation:
I have a development environment running on a Solaris 10 box. The vcs used is currently SCCS. It is planned to move this environment to a new box running Solaris 11. I was thinking of using this as an opportunity to move to a new vcs system, most likely Git.
I was wondering is it a case that we would have to just start fresh on the other box with a dump of the current repo from the old box or is it possible to preserve the repo history?
I have done a bit of searching SCCS to Git information seems quite scarce.
Thanks.
Upvotes: 5
Views: 3568
Reputation: 2792
Well before this question was first asked James Youngman had already written git-sccsimport
, a python script designed to "Import deltas collectively from SCCS files into git", aka "A fast git importer for SCCS files."
I have maintained and enhanced this script somewhat since and continue to use it to do regular migration of a couple of repositories I still maintain using SCCS (including the one for git-sccsimport
itself):
https://github.com/robohack/git-sccsimport
Some years ago, as a larger-scale test, I used this script to do a conversion of the CSRG BSD Unix SCCS files to create the following repository:
https://github.com/robohack/ucb-csrg-bsd
Upvotes: 1
Reputation: 14907
The need to do this must be increasingly rare, but I needed to do it today, for a curses-based program from 1986. (Surprisingly, it needed very little tweaking to make it run on a modern system.)
I came here looking for an answer, but neither of the two previous ones worked for me, mostly because the scripts and utilities linked to are unmaintained or no longer exist. However, I did find a good solution so I'm writing it down for any poor souls that still need to do this.
The overall plan is SCCS -> RCS -> CVS -> git. The unusual part is getting from SCCS to RCS, but Eric Raymond's sccs2rcs is maintained and works well. It's a Python script that uses only the core libraries, so is easy to install and is unlikely to break in the future. It depends on having sccs
and rcs
commands available, but these are typically available through third-party packaging systems (eg distro/homebrew). In the case of sccs
, I used CSSC.
Once you reach RCS, the path is more well-trodden. To convert a directory hierarchy containing RCS
subdirectories into a CVS repository, you just have to move the ,v
RCS files up one level out of those subdirectories and add an empty CVSROOT
directory at the top level.
To get from CVS to git, I used the well-maintained cvs2svn utility (widely available as a third-party package). It provides a cvs2git
script that works by generating blobs for use by git fast-import
. It works well, but is a little quirky in how it has to be configured. You have to copy the cvs2git-example.options
file and tweak it for your needs. I changed the directory in run_options.set_project
to be .
and added name(s) to the author mappings in author_transforms
.
I tied the RCS -> git steps together with the following script:
#!/bin/sh
set -e
MYDIR=$(dirname "$0")
# Move RCS files out of RCS subdirectories
find * -name RCS -type d |
while read RCS
do
mv -i $RCS/*,v $(dirname $RCS)
rmdir $RCS
done
# Create git import
mkdir -p CVSROOT
cvs2git --options="$MYDIR/cvs2git.options"
rmdir CVSROOT
# Import to git
git init -b master
cat cvs2git-tmp/git-blob.dat cvs2git-tmp/git-dump.dat | git fast-import
rm -r cvs2git-tmp
git reset --mixed
# Fix up $Id$ keywords
git ls-files | xargs -r sed --in-place '/$Id:/s/\([0-9]\)\//\1-/g'
# Back up RCS files
mkdir -p RCS-backup
find * -path RCS-backup -prune -o -name \*,v -print | cpio -pdml RCS-backup
find * -path RCS-backup -prune -o -name \*,v -print0 | xargs -0 -r rm -f
This will probably work for most people, but you do need to create cvs2git.options
by editing a copy of cvs2git-example.options
from the contrib directory of the cvs2svn
package.
Upvotes: 1
Reputation: 1324033
You could try and execute a script like sccs2git, trying to import the full history into a new Git repo.
However, it is best to check if the content of that legacy repo wouldn't be best managed in several Git repos (split), and if you can only import the last meaningful labels (which makes for a shorter import process), while keeping the legacy repo in read-only mode for archive.
Upvotes: 2
Reputation: 387607
There seems to be a “SCCS2Git” script, mentioned here. It’s in the TODO section, so one can only guess its status, but the sourcecode is available and it was “recently” (in 2015) moved to GitHub where it’s somewhat actively maintained (as in: There are recent commits). If you can figure out how it works, maybe you can give it a try (after backing things up obviously).
Otherwise I would probably go a less experimental route and convert to something else first. Git has a good interface to Subversion, and there seem to be a good number of converters from SCCS to Subversion, for example this. If you set up a local Subversion repository, you can probably export the data quickly and then import it as a new Git repository using git-svn.
Upvotes: 2