		Checkout of a module

> cvs -d /home/steve/writing/cvs-tutorial/examples/software checkout hello
cvs checkout: Updating hello
U hello/Makefile
U hello/hello.c
U hello/world.c
U hello/world.h



		Editing the module

> cd hello
> ls
CVS       Makefile  hello.c   world.c   world.h
> ls -l CVS
total 3
-rw-r--r--   1 steve    501           163 Jun 13 21:59 Entries
-rw-r--r--   1 steve    501             6 Jun 13 21:54 Repository
-rw-r--r--   1 steve    501            51 Jun 13 21:54 Root
> emacs hello.c
> cvs commit
cvs commit: Examining .
[editor for log message]
Checking in hello.c;
/home/steve/writing/cvs-tutorial/examples/software/hello/hello.c,v  <--  hello.c
new revision: 1.2; previous revision: 1.1
done
>



		Adding and Removing files

> vi README 
> cvs add README 
cvs add: scheduling file `README' for addition
cvs add: use 'cvs commit' to add this file permanently
> cvs commit  
cvs commit: Examining .
RCS file: /home/steve/writing/cvs-tutorial/examples/software/hello/README,v
done
Checking in README;
/home/steve/writing/cvs-tutorial/examples/software/hello/README,v  <--  README
initial revision: 1.1
done

[ Move functionality from world.c to hello.c ]

> rm world.c world.h
> cvs remove world.c world.h
cvs remove: scheduling `world.c' for removal
cvs remove: scheduling `world.h' for removal
cvs remove: use 'cvs commit' to remove these files permanently
> cvs commit
cvs commit: Examining .
Checking in Makefile;
/home/steve/writing/cvs-tutorial/examples/software/hello/Makefile,v  <--  Makefile
new revision: 1.2; previous revision: 1.1
done
Checking in hello.c;
/home/steve/writing/cvs-tutorial/examples/software/hello/hello.c,v  <--  hello.c
new revision: 1.3; previous revision: 1.2
done
Removing world.c;
/home/steve/writing/cvs-tutorial/examples/software/hello/world.c,v  <--  world.c
new revision: delete; previous revision: 1.1
done
Removing world.h;
/home/steve/writing/cvs-tutorial/examples/software/hello/world.h,v  <--  world.h
new revision: delete; previous revision: 1.1
done
> 


		Revisions, Releases, Tags

> ls
CVS       Makefile  README    hello.c
> cvs tag release-1_0
cvs tag: Tagging .
T Makefile
T README
T hello.c
>

> cvs -d /home/steve/writing/cvs-tutorial/examples/software checkout -r release-1_0 hello
cvs checkout: Updating hello
U hello/Makefile
U hello/README
U hello/hello.c



		Update

[ Colleague has changed the repository. ]

> cvs update
cvs update: Updating .
U ChangeLog
U README
? hello
> 


		Commit (revisited)

> ls
CVS        ChangeLog  Makefile   README     hello      hello.c    hello.o

[ Edited Makefile and hello.c ]


> cvs commit
cvs commit: Examining .
cvs commit: Up-to-date check failed for `ChangeLog'
cvs commit: Up-to-date check failed for `hello.c'
cvs [commit aborted]: correct above errors first!

> cvs update
cvs update: Updating .
U ChangeLog
M Makefile
RCS file: /home/steve/writing/cvs-tutorial/examples/software/hello/hello.c,v
retrieving revision 1.5
retrieving revision 1.6
Merging differences between 1.5 and 1.6 into hello.c
M hello.c
? hello
> 


> cvs commit    
cvs commit: Examining .
Checking in Makefile;
/home/steve/writing/cvs-tutorial/examples/software/hello/Makefile,v  <--  Makefile
new revision: 1.3; previous revision: 1.2
done
Checking in hello.c;
/home/steve/writing/cvs-tutorial/examples/software/hello/hello.c,v  <--  hello.c
new revision: 1.7; previous revision: 1.6
done
> 



		Resolving Conflict


> cvs commit
cvs commit: Examining .
cvs commit: Up-to-date check failed for `hello.c'
cvs [commit aborted]: correct above errors first!

> cvs update
cvs update: Updating .
RCS file: /home/steve/writing/cvs-tutorial/examples/software/hello/hello.c,v
retrieving revision 1.9
retrieving revision 1.10
Merging differences between 1.9 and 1.10 into hello.c
rcsmerge: warning: conflicts during merge
cvs update: conflicts found in hello.c
C hello.c

> cat hello.c
/*
 * This is a small example for a CVS tutorial.
 * For now, don't do much.  Just say hello to the nice folks!
 */

#include <stdio.h>
#include <time.h>


/** Number of days between now and 1 January, 2000.  **/
double doom_days( void )
{
    struct tm jan1_tm = {
        0,0,0,1,0,100,0,0
    };

    time_t jan1 = mktime( &jan1_tm );
    time_t now = time( NULL );

    return difftime( jan1, now ) / (60*60*24);
}



int main( int ac, char* av[] )
{
<<<<<<< hello.c
    if ( ac != 1 ) {
        fprintf( stderr, "usage: hello\n" );
        return 1;
    }

=======
    int show_doom = 0;

    if ( ac > 1 && strcmp( av[1], "-d" ) == 0 )
        show_doom = 1;

>>>>>>> 1.10
    printf( "Hello, world.\n" );

    if ( show_doom )
        printf( "You have %f days until the milennium bug hits!\n", doom_days() );
    return 0;
}




Informational command

> cvs log Makefile 

RCS file: /home/steve/writing/cvs-tutorial/examples/software/hello/Makefile,v
Working file: Makefile
head: 1.3
branch:
locks: strict
access list:
symbolic names:
        release-1_0: 1.2
keyword substitution: kv
total revisions: 3;     selected revisions: 3
description:
----------------------------
revision 1.3
date: 1999/06/14 02:56:44;  author: steve;  state: Exp;  lines: +1 -0
Now we can commit!
----------------------------
revision 1.2
date: 1999/06/14 02:19:31;  author: steve;  state: Exp;  lines: +2 -2
Removed the getworld() function.
----------------------------
revision 1.1
date: 1999/06/14 01:50:21;  author: steve;  state: Exp;
First working version of module hello.
=============================================================================


> cvs stat Makefile 
===================================================================
File: Makefile          Status: Up-to-date

   Working revision:    1.3     Mon Jun 14 02:53:08 1999
   Repository revision: 1.3     /home/steve/writing/cvs-tutorial/examples/software/hello/Makefile,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)



 > cvs diff -u -r 1.1 -r 1.3 hello.c
Index: hello.c
===================================================================
RCS file: /home/steve/writing/cvs-tutorial/examples/software/hello/hello.c,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -r1.1 -r1.3
--- hello.c     1999/06/14 01:50:21     1.1
+++ hello.c     1999/06/14 02:19:31     1.3
@@ -1,9 +1,11 @@
-#include <stdio.h>
-#include "world.h"
+/*
+ * This is a small example for a CVS tutorial.
+ */
 
+#include <stdio.h>
 
 int main( int ac, char* av[] )
 {
-    printf( "Hello, %s\n", getworld() );
+    printf( "Hello, %s\n", "world" );
     return 0;
 }



Branches





Creating a new repository

   > cvs -d /software/source/visualization init
   >


Creating a new module

   > mkdir hello
   > cd hello
   > cvs -d /software/source/visualization import vendor creation

   No conflicts created by this import

   > cd ..
   > rmdir hello
   > cvs -d /software/source/visualization checkout hello



