竹笋炒肉: OSW:12.CVS设置与应用

来源:百度文库 编辑:神马文学网 时间:2024/04/19 20:14:38
------安装-------
1)从 www.cvshome.org 下载 cvs-1.11.2.tar.gz
2)上传至unix
3)gunzip -c cvs-1.11.2.tar.gz|tar xvf -
4)cd cvs-1.11.2
4.5)./configure //可能要运行
5)make
6)make check
可能出现错误信息,但编译正常
7)su
8)make install
9)vi /etc/services,增加二行
cvspserver 2401/tcp # cvs client/server operations
cvspserver 2401/udp # cvs client/server operations
vi /etc/inetd.conf,增加一行
cvspserver stream tcp nowait root /usr/local/bin/cvs -f --allow-root=/export/home0/cvsroot pserver
10)vi /etc/profile,增加一行
CVSROOT=/export/home0/cvsroot;export CVSROOT
vi /.profile,增加一行
CVSROOT=/export/home0/cvsroot;export CVSROOT
11)/usr/sbin/groupadd cvs
12)/usr/sbin/useradd -g cvs -d /export/home0/cvsroot -m cvsroot
passwd cvsroot
/usr/sbin/useradd cvspub
/usr/sbin/usermod -G cvs cvspub
13)chmod 755 /export/home0/cvsroot
14)ps -aef|grep inetd
kill inetd
/usr/sbin/inetd -s
15)su - cvsroot
16)cvs -d /export/home0/cvsroot init
17)cvs -d :pserver:cvsroot@localhost:/export/home0/cvsroot login
[input the password of cvsroot]
-------管理-------
1)su - cvsroot
2)cd $CVSROOT/*T
3)/usr/local/apache/bin/htpasswd -b passwd ali alipwd
/usr/local/apache/bin/htpasswd -b passwd hehe hehepwd
4)vi passwd 在每行后面加
:cvspub
5)vi writers
ali
6)vi readers
hehe
----------------使用-----------------------
1、初始,将所有文件上传至cvs
cd qacodes
cvs import -m "qa:codes2 .h " qacodes yoyo start
下行作参考
cvs import -m "this is a cvstest project" cvstest v_0_0_1 start
2、在当前工作目录下,将修改诉文件上传
cd qacodes
cvs commit -m "Made some useful changes on some files"
3、增加新的文件
cd qacodes
cvs add new.c new.h
cvs commit -m "add 2 files:new.c new.h" new.c new.h
4、删除文件
cd qacodes
rm new.h
cvs remove new.h
cvs commit -m "delete new.h" new.h
5、定版本
cvs tag v0_0_1
取指定版本
cvs checkout -r v0_0_1 qacodes
6、更新工作目录中的文件
cvs update
--------------------------wincvs配置及使用------------------------
1)菜单
admin->preference->general
"Enter the CVSROOT"
:pserver:ali@168.160.1.106:/export/home0/cvsroot
"Authentication"
"passwd" file on the cvs server
2)菜单
admin->login
3)上传
左上modules中选定存放原文件的目录。
菜单
create->import module
4)checkout
菜单
create->checkout module
5)菜单
admin->logout
使用cvs
1)cvs checkout workdir //检出并生成一个工作目录,
U ...
.....
cd workdir
ls -l
2)cvs update //当工作目录中的文件被修改,并要做检入保存
U......某一文件被他人修改了,但你未修改
Merging...
M file 你与别人改了同一个文件file,但没有行冲突,故cvs将两者合并
cvs update //再次确认没有别的人改了这个文件
M file 确实只有你修改了这个文件
cvs commit file //只提交这个文件就可
3)cvs log file //查看file的修改历史
4)cvs diff -c -r 1.6 -r 1.7 file //比较file的1.6与1.7版的具体差异
此时的输出中,旧本从****开始,新的从----开始,数字是行号
如果***一行与----一行紧挨在一起,且一些行前有+,则是新对增加了几行。
5)ls newfile //增加一个新的文件
cvs update
newfile
cvs add newfile
cvs update
A newfile
cvs commit newfile
6)rm afile
cvs rm afile
cvs commit
7)cvs update
...
C afile//冲突
看文件冲突
8)cvs tag v_0_0_1 先标记一个版本:
然后你可以发布并删除你自己的工作目录里这个版本的文件(注意:不是删除仓库里的.):
$cvs release -d nasdaq
然后你再生成一个新分支:
$cvs rtag -b -r v_0_0_1 v_0_0_1_1 nasdaq
然后再建立v_0_0_1_1的分支
$cvs checkout -r v_0_0_1_1 nasdaq
编辑并修改这个分支的文件,这样的做法比较好
------------------------------------------------------
需要说明的是,如果在linux用xinetd启动服务的话,前面的设置会有些不同。
即需要在/etc/xinetd.d/目录下增加一名为cvspserver的文件,内容如下:
service cvspserver
{
socket_type = stream
protocol = tcp
wait = no
user =root
passenv =
server = /usr/local/bin/cvs
server_args = --allow-root=/usr/cvsroot pserver -f
disable = no
}