next up previous contents
Next: Shell Programming Up: cvs: A Tool for Previous: What is cvs?   Contents

Managing the Zoo Code

Just for fun we will put the Zoo program into a repository.

  1. Start by defining a Repository and initialising it.

      mkdir <some_scratch_directory>
      cd    <some_scratch_directory>
      mkdir Repository
      setenv CVSROOT <some_scratch_directory>/Repository
      cvs init
    

    CVS looks for the environmental variable CVSROOT that defines the location of the Repository. The init command is used to prime the Repository directory structure.

  2. Take a fresh copy of the source and import it into the Repository:-

      mkdir source
      cd source
      cp ~west/ttp/manual/unix_programming/cpp/*.c* ./
      cvs import Zoo V0 R0-0
    

    The last command tells CVS to import everything in the current directory into the Zoo directory in the Repository. It gives it an external version V0 and an internal version R0-0. CVS puts you into an editor (vi by default or whatever your EDITOR environmental variable is set to) and you have to enter some suitable comment, for example

    Initial commit

  3. Now check out the code into a work directory:-

      cd ../
      mkdir work
      cd work
      cvs checkout Zoo
    

    You should see CVS checkout the code into the Zoo directory within your work directory.

  4. Try the CVS commit and update commands, they will do nothing yet as nothing has changed since you took a copy of the code.

  5. Now edit one of the files and make a small change and try to commit again:-

      vi Zoo/GNUmakefile .. add some comment.
      cvs commit
    

    Now CVS will ask for a comment and commit your change as revision 1.2 (initially all revisions are called 1.1).

  6. Now type:-

    cvs log Zoo/GNUmakefile

    and get back a complete history of this file along with all the commit comments.

  7. If you want to see the conflict resolving machinery in action, go to another scratch directory and checkout Zoo again. Now modify the same file in both check out directories and try to commit both copies.


next up previous contents
Next: Shell Programming Up: cvs: A Tool for Previous: What is cvs?   Contents
P.D. Gronbech (IT Staff) 2015-10-02