cvs安装使用

[root@www ~]#yum install cvs
cvs 功能:
 1.跟踪的版本。
 2.记录改变日期及改变理由。
 3.具有回滚能力。
选择仓库:
[root@www ~]#useradd tom
[root@www ~]#echo redhat|passwd --stdin tom
[root@www ~]#useradd jack
[root@www ~]#echo redhat|passwd --stdin jack
 
[jack@www ~]$vim .bashrc
export CVSROOT=/var/cvs               #本地仓库
export CVSROOT=:ext:cvsserv:/var/cvs  #远程仓库
export CVS_RSH=/usr/bin/ssh           #添加双机信任
[jack@www ~]$source .bashrc                        #定义立即生效
[tom@www ~]$vim .bashrc
export CVSROOT=/var/cvs               #本地仓库
export CVSROOT=:ext:cvsserv:/var/cvs  #远程仓库
export CVS_RSH=/usr/bin/ssh           #添加双机信任
[tom@www ~]$source .bashrc                        #定义立即生效
                                  使用cvs
cvs使用的常用命令:
cvs checkout module               #下载仓库
cvs update                        #更新仓库
cvs add file                      #往仓库添加内容
cvs remove file                   #从仓库删除内容
cvs commit                        #提交
cvs  -d /var/cvs/        init     #cvs目录绑定
[root@www ~]#groupadd -g 6000 cvsadmin
[root@www ~]#grouadd -g 6001  cvsusers
[root@www ~]#usermod -a -G  cvsusers tom
[root@www ~]#usermod -a -G  cvsadmin tom
[root@www ~]#usermod -a -G  cvsusers jack
[root@www ~]#usermod -a -G  cvsadmin jack
[root@www ~]#mkdir  /var/cvs/dnsfile
cvs 
cvs import dnsfile training start     #提交dnsfile文件
cvs commit                        #提交
报错解决:
cvs commit 提交失败时使用cvs update 更新仓库使版本为最新,用cvs update 方能解决再提交。
案例解析;
1,添加新文件
cd  工作目录
[jack@www ~]$ create the file #创建新文件
[jack@www ~]$ cvs add file    #往cvs 添加新文件
[jack@www ~]$ cvs commit file #提交新文件
2.删除文件
[jack@www ~]$cd 工作目录
[jack@www ~]$rm file
[jack@www ~]$cvs remove file
[jack@www ~]$cvs commit file
3.给文件改名字
cd 工作目录
[jack@www ~]$mv old new
[jack@www ~]$cvs remove old
[jack@www ~]$cvs add  new
[jack@www ~]$cvs commit new
4.查看更改历史记录
[jack@www ~]$cvs history -a    #显示所有checkout的信息
[jack@www ~]$cvs history -a -c #显示所有commit的信息
[jack@www ~]$cvs log
[jack@www ~]$cvs diff
[jack@www ~]$cvs log file
[jack@www ~]$cvs diff -r oldfile newfile
5.回滚历史版本
[tom@www ~]$rm  file
[tom@www ~]$cvs update -j HEAD -j 1.1 file 
[tom@www ~]$cvs commit file
6.定义二进制文件
[tom@www ~]$ vim CVSROOT/cvswrappers
 *.gif -k 'b' -m 'COPY' 
[tom@www ~]$cvs add -kb file.jpg #添加二进制文件
[tom@www ~]$cvs commit file.jpg