An Introduction To Using: CVS Tutorial
An Introduction To Using: 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
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
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
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
1.1
README
hello.c
Makefile
1.0
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
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
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;
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;
}
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() );
}
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
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
also: D date
examples:
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
p. 19/1