0% found this document useful (0 votes)
19 views

An Introduction To Using: CVS Tutorial

This document provides an introduction to using the Concurrent Versions System (CVS) for software collaboration and configuration management. It describes key CVS concepts like checking code out of a repository into a workspace, editing code, committing changes, tagging releases, and resolving conflicts when merging changes. The document also provides examples of common CVS commands for operations like checkout, commit, add, remove, tag, log and diff.

Uploaded by

Nagaraj Bajantri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

An Introduction To Using: CVS Tutorial

This document provides an introduction to using the Concurrent Versions System (CVS) for software collaboration and configuration management. It describes key CVS concepts like checking code out of a repository into a workspace, editing code, committing changes, tagging releases, and resolving conflicts when merging changes. The document also provides examples of common CVS commands for operations like checkout, commit, add, remove, tag, log and diff.

Uploaded by

Nagaraj Bajantri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

CVS Tutorial

An Introduction to Using
C VS
Concurrent
* collaboration

Versions System
* history: when? why?
* examine old revisions
* bugfix releases

Steve Robbins

p. 1/1

CVS Tutorial

checkout
Repository

commit
Workspace

p. 2/1

CVS Tutorial
checkout

commit
edit

commit

edit

p. 3/1



      
      
     
  
    







CVS Tutorial

cvs d repositoryname checkout modulename


> cvs d /software/examples checkout hello
cvs checkout: Updating hello
U hello/Makefile
U hello/hello.c
U hello/world.c
U hello/world.h

p. 4/1

CVS Tutorial
> cd ~/src
> cvs d /software/examples checkout hello
cvs checkout: Updating hello
U hello/Makefile
U hello/hello.c
U hello/world.c
U hello/world.h

checkout
> cd hello
> ls
CVS
Makefile hello.c world.c world.h

> ls CVS
Entries Repository Root

p. 5/1

CVS Tutorial
> cvs commit
cvs commit: Examining .

CVS:
CVS: Enter Log. Lines beginning with CVS: are removed automatically
CVS:
CVS: Committing in .

commit

$CVSEDITOR
$EDITOR

Checking in hello.c;
/software/examples/hello/hello.c,v < hello.c
new revision: 1.2; previous revision: 1.1
done

p. 6/1

CVS Tutorial
> 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: /software/examples/hello/README,v
done
Checking in README;
/software/examples/hello/README,v < README
initial revision: 1.1
done

add

create
file

Remove files:

ChangeLog

commit
ChangeLog

rm filename; cvs remove filename

Rename files: remove then add

p. 7/1

CVS Tutorial
release2_0

1.2.2.1

1.0.1

1.1

1.1.2

1.2

1.3

1.2

1.3

1.4

1.1.3

The Source Tree

1.2

file C

file A

file B

file D

release1_0
1.0

1.0

1.0

1.0

1.1

1.1

1.2

1.1

1.0

1.3

release1_1

file E

p. 8/1

1.0

1.0

1.1

1.2 1.3

1.4

release1_0

1.0

Moral: use cvs tag c ...

1.1

README
hello.c
Makefile

1.0

> cvs tag release1_0


cvs tag: Tagging .
T Makefile
T README
T hello.c

tag

1.1

hello.c
1.4

1.0

Makefile
1.1

1.0

README
1.0

1.1

1.2 1.3

1.4

CVS Tutorial

README
hello.c
Makefile

p. 9/1

CVS Tutorial
Collaborative Development

checkout

You

checkout

Developer X.

p. 10/1

CVS Tutorial

commit

update

You

Developer X.
> cvs update
cvs update: Updating .
U ChangeLog
U README

p. 11/1

CVS Tutorial

commit

1.3

1.1

1.4

> cvs commit


cvs commit: Examining .
cvs commit: Uptodate check failed for README
cvs commit: Uptodate check failed for hello.c
cvs [commit aborted]: correct above errors first!

1.1
1.0

1.0

1.0

1.1

1.2

checkout

README
hello.c
Makefile

You

Developer X.
Moral: update before commit.

p. 12/1

CVS Tutorial

1.3
1.2

1.5
1.1
1.0

1.0

1.0

1.1

1.2

1.1

1.3

1.4

1.1
1.0

> cvs update


cvs update: Updating .
U ChangeLog
M Makefile
RCS file: /software/examples/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

1.6

Update (revisited)

README
ChangeLog
hello.c
Makefile

p. 13/1

CVS Tutorial
> cvs update
cvs update: Updating .
RCS file: /software/examples/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
int main( int ac, char* av[] )
{
int show_doom = 0;

int main( int ac, char* av[] )


{
if ( ac != 1 )
{
fprintf( stderr, "usage ..." );
return 1;
}
printf( "Hello, world.\n" );

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


show_doom = 1;
printf( "Hello, world.\n" );

int main( int ac, char* av[] )


{
printf( "Hello, world.\n" );
}

1.9

1.10

if ( show_doom )
printf( "You have %f days until the "
" millenium.\n", doom_days() );

commit
int main( int ac, char* av[] )
{
printf( "Hello, world.\n" );
}

hello.c

You

Developer X.

p. 14/1

CVS Tutorial
Conflict Resolution
int main( int ac, char* av[] )
{
if ( ac != 1 ) {
fprintf( stderr, "usage ..." );
return 1;
}

int main( int ac, char* av[] )


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

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

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

hello.c before update


}

if ( show_doom )
printf( "You have %f days until the "
" millenium.\n", doom_days() );

revision 1.10
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 "
" millenium.\n", doom_days() );
}

hello.c after update

p. 15/1

CVS Tutorial

README

1.1
1.0

1.0

1.0

1.1

1.2

1.0

1.1

release1_0

ChangeLog

1.3

1.4

1.1

1.5

1.6

Why Branch?

Makefile hello.c

p. 16/1

CVS Tutorial
release3_5

2.2.

3.7

1.1

1.1

2.5.

2.4

1.0
3.6.

1.2

1.1

foo.c
2.5.

rele

ase

3_4

fix

es

release3_4

README Makefile

2.1.2

3.6

> cvs tag b release3_4fixes


cvs tag: Tagging .
T README
T Makefile
T hello.c

2.4

2.5

rele

ase

3_

4_1

2.3

1.1

hello.c

p. 17/1

CVS Tutorial
checkout (revisited)
cvs d repositoryname checkout modulename
= latest revisions on HEAD branch (main trunk)
cvs d repositoryname checkout r releasetag modulename
= revisions selected by tag name
cvs d repositoryname checkout r branchtag

modulename

= latest revisions on specified branch

also: D date

examples:

D "13:45 1 December 1997"


D "5 days ago"

p. 18/1

CVS Tutorial
Command Summary
cvs d repository init
= create a new repository
cvs d repository import module vendortag releasetag
= create a new module

cvs d repository checkout [r tag] module


cvs update [r tag]
cvs add file ...
cvs remove file ...
cvs commit
cvs tag c [b] tag
cvs log
= list log messages, tags, etc
cvs status
= uptodate, locallymodified, etc
cvs diff r rev1 r rev2 file
= difference between specified revisions

p. 19/1

You might also like