CVS Commands
Prepare a directories
# mkdir repo
# cd repo
# mkdir TKS
Change directories permission
# chmod g+srwx /repo/TKS
or
# chmod 2777 /repo/TKS
Change group permissions
# groupaddc cvsgrp /repo/TKS
# chgrp cvsgrp /repo/TKS
Initialize a repository
# cvs -d /repo/TKS init
Import existing project, go to existing project directory first
# cd ~/Platform
# cvs -d /repo/TKS/ import -m "Baseline" ProjectPlatform INITIAL start
Treat certain file (std.lib) as binary
# cvs -d /repo/TKS/ admin -kb std.lib
Tag when release a version
# cvs -d /repo/TKS/ tag RELEASE_V02_20100201
Tag delete
# cvs -d /repo/TKS/ tag -d RELEASE_V02_20100201
Configure CVSROOT env variable in bash shell (so that "-d /repo/TKS" can be omit)
# vi ~/.bashrc
CVSROOT=/repo/TKS; export CVSROOT
Checkout (go to check out directory first)
$ cd ~/Project
$ cvs -d /repo/TKS co ProjectPlatform
Checkout particular subdirectory (go to check out directory first)
$ cd ~/Project/src
$ cvs checkout ProjectPlatform/src
Different
$ cvs -d /repo/TKS/ diff
Update (“-P” to prune empty directory, “-d” to include new directory that non-exist in local workspace)
$ cvs -d /repo/TKS/ update –P -d
Update (filter off other, only display other than "cvs update")
$ cvs -d /repo/TKS/ update –P -d | grep -v "cvs update"
Commit
$ cvs -d /repo/TKS/ commit –m "bug fixed for wrong upper limit"
Add file/directory (First, create file or directory, edit it)
$ cvs -d /repo/TKS/ add /usr/src/new/
$ cvs -d /repo/TKS/ add /usr/src/new/new.c
$ cvs -d /repo/TKS/ commit –m "added new.c"
Add file/directory recursively
$ find . -type d -print | grep -v CVS | xargs cvs add
$ find . -type f -print | grep -v CVS | xargs cvs add
Delete file
$ rm –rf old.c
$ cvs -d /repo/TKS/ delete /usr/src/old.c
$ cvs -d /repo/TKS/ commit –m "delete old.c"
Revert local changes
$ cvs -d /repo/TKS/ update -C
Check which tags exist on a file
$ cvs -d /repo/TKS/ status -v
or
$ cvs -d /repo/TKS/ log -h