- Access a new repository
- local repository
#> cvs -d /usr/local/cvs command - password-authenticated server
the password can be stored in#> cvs -d :pserver:jrandom@cvs.foobar.com:/usr/local/cvs command~/.cvspasswith
and can be removed from#> cvs -d :pserver:jrandom@cvs.foobar.com:/usr/local/cvs login~/.cvspasswith#> cvs -d :pserver:jrandom@cvs.foobar.com:/usr/local/cvs logout - external connection program
#> CVS_RSH=rsh; export CVS_RSH
#> cvs -d :ext:jrandom@cvs.foobar.com:/usr/local/cvs command - the other protocols are kserver (Kerberos) and gserver (Generic Security Services API)
- the
-dflag can be replaced by defining the environment variableCVSROOT#> CVSROOT=:pserver:jrandom@cvs.foobar.com:/usr/local/cvs; export CVSROOT
- local repository
- create a project
#> cvs import -m "log msg" projname vendortag releasetag - Checking out a working copy
or#> cvs checkout myproj#> cvs co myproj- specifying the revision
#> cvs checkout -r 1.3 myproj - specifying the tag
#> cvs checkout -r MyTag myproj - list all the modukes
#> cvs co -c
- Creating/removing elements
- creating a file requires two steps: first the
addcommand on it, thencommit:#> cvs add newfile.c
#> cvs ci -m "added newfile.c" newfile.c - keyword expansion and line-ending conversion must be turned off to add binary files:
#> cvs add -kb newfile.c - it is also possible to remove keyword expansion for some files:
#> cvs add -ko newfile.c - removing a file requires first to remove the file from the working directory:
#> rm newfile.c
#> cvs remove newfile.c
#> cvs ci -m "removed newfile.c" newfile.c - creating a directory requires just the
addcommand:#> mkdir newdir
#> cvs add newdir - to remove a directory from a project, first remove all the files in it
the#> cd newdir
#> rm file1 file2 file3
#> cvs remove file1 file2 file3
#> cvs ci -m "removed all files" file1 file2 file3
#> cd ..
#> cvs update -P-Poption tells update to prune all empty directories - rename a file
#> mv oldname newname
#> cvs remove oldname
#> cvs add newname
#> cvs ci -m "renamed oldname to newname" oldname newname - rename a directory
#> mkdir newdir
#> cvs add newdir
#> mv olddir/* newdir
mv: newdir/CVS: cannot overwrite directory (this is not a problem)
#> cd olddir
#> cvs rm foo.c bar.txt
#> cd ../newdir
#> cvs add foo.c bar.txt
#> cd ..
#> cvs commit -m "moved foo.c and bar.txt from olddir to newdir"
#> cvs update -P
- creating a file requires two steps: first the
- status
#> cvs status hello.c - History
- dump the log of the file
#> cvs log hello.c - for each file of the file, indicate whan, who and on which revision the change has been done
#> cvs annotate hello.c
- dump the log of the file
- Update
#> cvs update- to a given revision
#> cvs update -r 1.2 - to a given tag
#> cvs update -r MyTag
- Diff
#> cvs diff- use
to perform a context diff-c#> cvs diff -c foobar.c - use
to specify the version to use as the reference to be compared with the working copy-r
or both versions#> cvs diff -r 1.218.2.14 toto.c#> cvs diff -r 1.218.2.14 -r 1.218.2.13 toto.c
- tkdiff
- compare a file with its repository revision
#> tkdiff hello.c - compare two text files
#> tkdiff foo bar
- compare a file with its repository revision
- commit
or#> cvs commit -m "print goodbye too" hello.c#> cvs ci -m "print goodbye too" hello.c - Tag
- a tag name starts with a letter and contain letters, digits, hyphens (
-), and underscores (_). - CVS has two different kinds of tags:
Sticky tags which are tightly bound to one particular revision number for a given file
Branch tags that allow you to check in new revisions. cvs taguses a file system hierarchy determine which revisions to associate with the label
cvs rtagworks directly on the repository.- create a sticky tag from an existing hierarchy
#> cvs tag MyTag - create a branch tag from an existing hierarchy
#> cvs tag -R -b MyTag - create a branch tag from an existing tag
#> cvs tag -r ExistingTag -b MyTag - move the tag
MyTagto version 1.11 for thefoobar.cfile#> cvs tag -r 1.11 -F MyTag foobar.c - delete a tag
#> cvs rtag -d MyTag MyProject
- a tag name starts with a letter and contain letters, digits, hyphens (
- Help
- return the version of the client and of the server
#> cvs version - return the list of synonyms
#> cvs --help-synonyms
- return the version of the client and of the server