Search: 
 
View
  By section
  As outline
  Fully expanded

FAQ sections
  cvs

Questions
  Getting account
  Getting started
  cvs-remote-links
  CVS Clients
  cvs-local-resources
  common-commands
  common-tasks
  CVS and Eclipse
  admin-commands
  EDITOR-variable
  no password
  cvs-laptop
  change-password
  cvs-authoring
  Administrator/mkpasswd
  CVS account name
  Cygwin home dir
  Cygwin CR/NL problems
  Who gets one?
  anonymous access
  SCCS/RCS/CVS conversion
  Failed to connect . . .
  cvs update is slow
  cvs mail
  Cygwin copy & paste
  CVS Web Interface
  SVN vs CVS
  CVS on the Mac
 
Software Development
FAQ
CVS
Previous section  |  This section  |  Next section
Previous question  |  This question  |  Next question

How do I convert from SCCS or RCS to CVS
Christopher Brooks, 30 Apr 2001

Resources:

  • Cyclic SCCS page
  • CVS/SCCS command comparison
  • University of Houston CVS Manual - includes SCCS conversion notes
  • Converting from SCCS to CVS is not that difficult, there are scripts in the contrib directory that is shipped with the cvs source code. The basic idea is that one backs up the SCCS tree, converts to RCS and then converts to CVS.

    The notes below discuss the conversion of the Ptolemy II SCCS tree to CVS.

  • Use cvs annotate to get the same functionality as sccs get -p -m.
  • When I used it a few years ago, the source tree ended up getting destroyed several times. Before applying CVS to the entire tree, I'd like to have some experience with smaller packages.
  • Converting from SCCS to RCS can be done automatically with sccs2rcs which is shipped in the contrib directory of CVS. Locally, this can be found at /usr/eesww/share/gnu/cvs/lib/cvs/contrib/sccs2rcs.
  • We need to be sure that the makefiles can deal with CVS. Currently, we use $PTOLEMY/bin/safe-get to update SCCS files. I'm not sure how this would work in CVS
  • %W% %G% should be converted to $Id$
  • %G% should be converted to $Date$
  • RCS does not include an equivalent to the SCCS %Q% keyword, so we will have to spend time reconstructing the copyright system. The RCS keywords that cvs uses are listed in rcs.c:
    static const struct rcs_keyword keywords[] =
    {
        { KEYWORD_INIT ("Author") },
        { KEYWORD_INIT ("Date") },
        { KEYWORD_INIT ("Header") },
        { KEYWORD_INIT ("Id") },
        { KEYWORD_INIT ("Locker") },
        { KEYWORD_INIT ("Log") },
        { KEYWORD_INIT ("Name") },
        { KEYWORD_INIT ("RCSfile") },
        { KEYWORD_INIT ("Revision") },
        { KEYWORD_INIT ("Source") },
        { KEYWORD_INIT ("State") },
        { NULL, 0 }
    };
     
  • A CVS training manual says
    SCCS is a file by file revision control system, while CVS is a repository based system. By and large the greatest task in moving from SCCS to CVS is the change in the development mentality from developer controlled source files to a centralised repository based systems. Having said that, the vast majority of SCCS based development sites that I have encountered have already set up a repository of sorts, because doing that is just good SCM practise.

    Some important points to note when converting to CVS from SCCS:

  • CVS requires other programs to do some of its work -- in particular RCS and Diff are required. Although a diff utility is provided with most operating systems, I recommend that you upgrade to GNU diff (version 2.7 or later) in the process of upgrading to CVS.
  • Make sure that you have the latest version of RCS (version 5.7 is recommended).
  • Ensure that the developers and management are informed well in advance of the change. This may be a change of toolset, but it also requires a change of development mentality.
  • In converting from RCS to CVS, make sure that you follow these steps:

  • Create a CVS repository. Within this repository you should create an empty directory structure to hold the RCS files.
  • Keep a backup copy of your SCCS files in their original location just in case there are any mishaps. There is a CVS supplied utility called sccs2rcs that will convert all SCCS files in an SCCS/ directory to RCS files in an RCS/ directory. This performs most of the work in doing the actual file level conversion.
  • Copy the RCS files created by sccs2rcs into the repository using the standard unix file copy utilities (cp -rp is useful, as is tar). During this stage, make sure that you don't lose track of your repository structure.
  • Update the modules file in CVSROOT. This can be updated using cvs co modules or cvs co CVSROOT, editing the modules file, and checking it back in again. You should make sure that there is an entry in the modules file for every directory (top level and subdirectory) in the repository.
  • Test the change by attempting to cvs co a few of the new modules you have created, and running cvs log or cvs status on some of the files you have checked out.
  • It may pay to perform some pre-planning for the above steps in this order:

  • Create the CVSROOT directory structure in advance. Create and update a modules file so that you know what directory structure you are working towards. Print out a copy of this structure and keep it handy -- a diagram or two showing the directory tree structure may be useful here, both to the SCM staff and the developers.
  • sccs2rcs is a lengthy process. If you have an existing repository of SCCS files, you may be able to create a script to do both the sccs2rcs conversion and moving the subsequently created RCS files into the repository. Run sccs2rcs a few times on test files so that you know what it does.
  • Converting from RCS to CVS

    Once you've converted from SCCS to RCS, you need to convert from RCS to CVS.

    The CVS info documentation says:

    From RCS
     

    If you have been using RCS, find the RCS files--usually a file named `foo.c' will have its RCS file in `RCS/foo.c,v' (but it could be other places; consult the RCS documentation for details). Then create the appropriate directories in CVS if they do not already exist. Then copy the files into the appropriate directories in the CVS repository (the name in the repository must be the name of the source file with `,v' added; the files go directly in the appopriate directory of the repository, not in an `RCS' subdirectory). This is one of the few times when it is a good idea to access the CVS repository directly, rather than using CVS commands. Then you are ready to check out a new working directory.

    The RCS file should not be locked when you move it into CVS; if it is, CVS will have trouble letting you operate on it.

    A CVS training manual says:

    9.1 Moving from RCS to CVS

    Migration from RCS to CVS is a relatively painless process. CVS uses RCS for all of its file level version control, and so RCS files can be directly copied into a CVS repository.

    In converting from RCS to CVS, make sure that you follow these steps:

  • Create a CVS repository. Within this repository you should create an empty directory structure to hold the RCS files.
  • Keep a backup copy of your RCS files in their original location just in case there are any mishaps.
  • Copy the files into the repository using the standard unix file copy utilities (cp -rp is useful, as is tar).
  • Update the modules file in CVSROOT. This can be updated using cvs co modules or cvs co CVSROOT, editing the modules file, and checking it back in again. You should make sure that there is an entry in the modules file for every directory (top level and subdirectory) in the repository.
  • Test the change by attempting to cvs co a few of the new modules you have created, and running cvs log or cvs status on some of the files you have checked out.
  • Steps to convert one directory from SCCS to CVS

    1. sccs2rcs
    2. co RCS/*

    Steps to convert a tree from SCCS to CVS

    1. Cleanup, removing .class files and codeDoc
      make distclean
      cd ptolemy
      find . -name "*.class" -exec rm {} \;
      find . -name "*codeDoc" -exec rmdir {} \;
      
    2. Be sure that there are no files checked out
      cd ~ptII
      make sccsinfo
      
      /users/ptII/adm/cvs/unsccsedit might help for testing
    3. You may want to remove all the extra sccs files that are not being used. One way to do this is to do a sccs get SCCS in all the directories and then run make checkjunk and move the SCCS files to a junk directory.
    4. The following script located at /users/ptII/adm/cvs/getallsccs will get all the SCCS files
      #!/bin/sh
      homedir=`pwd`
      dirs=`find . -name SCCS -print`
      for dir in $dirs
      do
      	echo $dir
      	cd $homedir
      	cd $dir/..
      	sccs get SCCS
      done
      
      	
    5. The run make checkjunk
    6. If you place the output of make checkjunk into a file, then run the script below to generate another script that will move the junk files into a junk directory.
      #!/bin/sh
      
      grep 'Extra files' sccsfiles | sed 's@Extra files in /export/carson/carson2/cxh/tmp/ptII/@@' | sed 's/://' |
      awk '  { print "mkdir -p /users/cxh/tmp/junk/"$1"/SCCS"
      	for(i=2;i<=NF;i++) {
      		print "mv "$1"/SCCS/s."$i" /users/cxh/tmp/junk/"$1"/SCCS"
      		print "mv "$1"/"$i" /users/cxh/tmp/junk/"$1
      	}
      }
      
      
    7. Repeat running make checkjunk the script above and the output script until make checkjunkfinds no garbage:
      	make checkjunk >> sccsfiles
      	moveoldsccs > moveoldsccs.sh
      	sh moveoldsccs.sh
      	
      and repeat
    8. Convert from SCCS to RCS:
      /users/ptII/adm/sccs2cvs/sccs2rcsall -q
      
      sccs2rcsall is a locally modified version of contrib/sccs2rcs that is shipped with the cvs sources. The version that is shipped with cvs has y2k hacks not present in the local copy, so use the most current version from the cvs sources.
    9. Check that there are no SCCS directories:
      find . -name SCCS -ls
      
      If there are any, fix the problems and rerun sccs2rcsall
    10. Check out all the files from RCS
      /users/ptII/adm/sccs/2cvs/coall
      
      coall looks like:
      #! /bin/sh
      # Check out all the files from RCS in a tree
      dirs=`find . -xdev -type d | egrep -v "SCCS|adm|RCS|CVS|codeDoc"`
      homedir=`pwd`
      for dir in $dirs
      do
              echo $dir
              cd $dir
              co RCS/*
              cd $homedir
      done
      
    11. Initialize the repository
      setenv CVSROOT ~/tmp/ptII/Repository
      cvs init
      
    12. Convert from RCS to CVS
      cd ptII
      /users/ptII/adm/cvs/ptrcs-to-cvs ptII
      
      ptrcs-to-cvs is a version of cvs-1.11/contrib/rcs-to-cvs with the following changes:
      cxh@maury 67% diff -c ~/src/cvs-1.11/contrib/rcs-to-cvs ptrcs-to-cvs
      *** /home/eecs/cxh/src/cvs-1.11/contrib/rcs-to-cvs      Mon Sep 25 18:59:01 200\
      0
      --- ptrcs-to-cvs        Thu Nov 12 14:01:25 1998
      ***************
      *** 90,96 ****
      
        if [ -d SCCS ]; then
            echo SCCS files detected! >&2
      !     exit 1
        fi
        if [ -d RCS ]; then
            co RCS/*
      --- 90,97 ----
      
        if [ -d SCCS ]; then
            echo SCCS files detected! >&2
      !     #exit 1
      !     exit 0
        fi
        if [ -d RCS ]; then
            co RCS/*
      ***************
      *** 99,105 ****
        for name in * .[a-zA-Z0-9]*
        do
            case "$name" in
      !     RCS | *~ | \* | .\[a-zA-Z0-9\]\* ) continue ;;
            esac
            echo $name
            if [ $vbose -ne 0 ]; then
      --- 100,106 ----
        for name in * .[a-zA-Z0-9]*
        do
            case "$name" in
      !     Repository | RCS | SCCS | old-SCCS | adm | codeDoc | *~ | \* | .\[a-zA-Z0\
      -9\]\* ) continue ;;
            esac
            echo $name
            if [ $vbose -ne 0 ]; then
      ***************
      *** 158,171 ****
                              echo "MSG: Copying old rcs file."
                              cp RCS/"${name}",v "$file"
                      else
      !                   if [ -n "${comment}" ]; then
      !                       rcs -q -i -c"${comment}" -t${message_file} -m'.' "$file\
      "
      !                   fi
      !                   ci -q -u1.1 -t${message_file} -m'.' "$file"
      !                   if [ $? -ne 0 ]; then
      !                       echo "ERROR: Initial check-in of $file failed - abortin\
      g" >&2
      !                       exit 1
      !                   fi
                      fi
                  else
                      file="${update_dir}/Attic/${name},v"
      --- 159,174 ----
                              echo "MSG: Copying old rcs file."
                              cp RCS/"${name}",v "$file"
                      else
      !                   echo "MSG: not checking in $name, since it is not in RCS"
      !
      !                   #if [ -n "${comment}" ]; then
      !                   #    rcs -q -i -c"${comment}" -t${message_file} -m'.' "$fil\
      e"
      !                   #fi
      !                   #ci -q -u1.1 -t${message_file} -m'.' "$file"
      !                   #if [ $? -ne 0 ]; then
      !                   #    echo "ERROR: Initial check-in of $file failed - aborti\
      ng" >&2
      !                   #    exit 1
      !                   #fi
                      fi
                  else
                      file="${update_dir}/Attic/${name},v"
      
     
    Previous section  |  This section  |  Next section
    Previous question  |  This question  |  Next question
    You are not logged in
    ©1998-2008 GSRC