Comment dois-je convertir de SCCS ou RCS vers CVS
Christopher Brooks, 30 Apr 2001 -
Traduit par Alain Adelmar

Resources:

  • Cyclic SCCS page
  • Comparaison de commande CVS/SCCS
  • Université de Houston Manuel CVS - comprend des notes de conversion SCCS

  • La conversion à partir de SCCS vers CVS n'est pas si difficile, il y a des scripts dans le répertoire contrib qui sont fournis avec le code source cvs. L'idée de base est que la sauvegarde de l'arbre SCCS, se transforme en RCS puis convertit ensuite en CVS.

    Les notes ci-dessous parle de la conversion de l'arbre de Ptolémée II SCCS en CVS.

  • Utilisez cvs annotate pour obtenir les mêmes fonctionnalités que sccs get -p -m.
  • Lorsque je l'ai utilisé il ya quelques années, l'arbre des sources a fini par s'être détruit à plusieurs reprises. Avant d'appliquer CVS à l'arbre tout entier, je voudrais avoir une certaine expérience avec de plus petits paquets.
  • La conversion à partir de SCCS vers RCS peut être fait automatiquement avec sccs2rcs qui est fourni dans le répertoire contrib de CVS. Localement, cela peut être trouvé à  /usr/eesww/share/gnu/cvs/lib/cvs/contrib/sccs2rcs.
  • Nous devons être sûrs que les makefiles peuvent traiter avec CVS. Actuellement, nous utilisons $PTOLEMY/bin/safe-get pour mettre à jour les fichiers SCCS. Je ne sais pas comment cela pourrait fonctionner dans le CVS.
  • %W% %G% devrait être converti en $Id$
  • %G% devrait être converti en $Date$
  • RCS n'inclue pas d'équivalent au mot-clé SCCS %Q% , alors nous aurons à passer du temps en reconstruisant le système du droit d'auteur. Les mots-clés RCS qui utilise cvs sont répertoriés dans 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 }
    };
  •   Le manuel de formation CVS dit:
    CSSC est un système de contrôle de révision, fichier par fichier, tandis que CVS est un système basé sur répertoire. Dans l'ensemble la plus grande tâche dans le déplacement du SCCS vers CVS est le changement dans la mentalité de développement du développeur de fichiers source contrôlée à un référentiel centralisé des systèmes basés. Cela dit, la grande majorité des sites de développement basé SCCS que j'ai rencontrés ont déjà mis en place un référentiel de chaque sortes, car de faire cela il découle juste que se sont de bonnes pratiques SCM.

    Quelques points importants à retenir lors de la conversion de CVS à partir de SCCS:

  • CVS nécessite d'autres programmes pour faire une partie de ses travaux - en particulier RCS et Diff sont nécessaires. Même si un utilitaire diff est fourni avec la plupart des systèmes d'exploitation, je vous recommande de passer à GNU diff (version 2.7 ou version ultérieure) dans le processus de mise à niveau vers CVS.
  • S'assurer d'avoir la dernière version de RCS (la version 5.7 est recommendée).
  • Veiller à ce que les développeurs et la gestion sont informés bien à l'avance du changement. Cela peut être un changement de boîte à outils, mais elle exige également un changement de mentalité de développement.
  • En convertissant du RCS en CVS, assurez vous de suivre les points suivants:

  • Créer un dépôt CVS. Dans ce référentiel, vous devez créer une structure de répertoire vide pour y stocker les fichiers RCS.
  • Conservez une copie de sauvegarde de vos fichiers SCCS dans leur emplacement d'origine au cas où il y aurait des accidents. Il y a un utilitaire CVS fourni appelé sccs2rcs qui vous permet de convertir tous les fichiers SCCS dans un répertoire SCCS/ et les fichiers RCS dans un répertoire RCS/.  Ceci exécute la plupart des travaux à effectuer la conversion de fichier réel niveau.
  • Copiez les fichiers RCS créés par sccs2rcs dans le référentiel en utilisant l'utilitaires de copie standard de fichier Unix (cp-rp est utile, comme l'est tar).  Au cours de cette étape, assurez-vous que vous n'avez pas perdu la trace de la structure de votre référentiel.opy 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.
  • Mise à jour le fichier modules dans CVSROOT. Cela peut être mis à jour en utilisant cvs co modules ou cvs co CVSROOT,  éditant le fichier modules, et le contrôle de retour à nouveau. Vous devez vous assurer qu'il y a une entrée dans le fichier modules pour chaque répertoire (plus haut niveau et de sous-répertoire) dans le référentiel.
  • Test du changement en essayant de cvs co quelque'un des nouveaux modules que vous avez créé, et en cours
      d'exécution cvs log ou le statut cvs sur certains des fichiers que vous avez vérifié (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"