CVS的使用(一课时)

第四部分:CVS  版本控制系统
CVS简介
版本控制系统is a version control system;
The Repository 仓库
Repository 仓库(服务器端)
Working directory工作目录(客户端)
是C/S结构的用于UNIX或LINUX平台

Creating Repository 创建仓库
1.Create repository root directory
    for example:
    # mkdir /export/cvs/openlab
    创建目录
2.chgrp the repository's' root directory
    for example:
    # chgrp other /export/home/cvs/openlab
    更改访问组
3.chmod the repository's' root directory
    for example:
    # chmod g+rwx /export/home/cvs/openlab
    更改读写执行权限
4.Set up the directory as a CVS Repository
    for example:
    # cvs -d /export/home/cvs/openlab init
    初始化

Accessing Repository
Local Reository
1.Using CVS command line with the -d option
    for example:
    cvs -d/export/home/cvs/openlab checkout foo
2.Set CVSROOT environment variable
    csh and tcsh:
       setenv CVSROOT /export/home/cvs/openlab
    sh and bash:
       CVSROOT /export/home/cvs/openlab
       export CVSROOT
第三章 :Using CVS
Basic Use of CVS
1、CVS Command Syntax

登录 cvs login
登出 cvs logout
2、Importing Project
1    导入,将数据放置到CVS服务中
    cvs import -m "这里放置一个字符串,可以为空如 :new
    project"(message的缩写) jul12_cjProject tarena start
    必须进入到临时目录里面

2    --把项目从仓库拿到本地目录中(本机执行)
    cvs checkout jul12_cjProject;

3    cvs status --没有参数查看所有文件的状态信息

4    --提交命令
    cvs commit -m(message)"这里放置一个字符串,可以描述为对该文件修改的内容"
5    --新程序文件的放入
    cvs add b.txt(文件的名字)
    --不这么写CVS不会帮您 管理这个文件可以用cvs status b。txt查看状态
    cvs status b.txt
    working revision:     New file!
    Repository revision:    No revision control file
    上面可以查看,发现没有版本号码,为什么呢。。因为你是在本地阿,要提交的服务器上就可以了。
    CVS commit -m (message) "此程序添加了一个b.txt 文件";
    提交完成就可以了,那么这个时候的status 就变成了Up-to-date
6.    --删除文件
    先在自己的工作目录中删除
    rm a.txt   --删除a.txt
    通知CVS服务器
    cvs remove a.txt --通知CVS要删除 a.txt
    cvs status a.txt --查看状态
================================
    FIle: no file a.txt  Status: Locally Removed
    ...
    修改提交到仓库里面
    cvs commit -m "remove a.txt" a.txt
注意:在仓库中,和本地不一样,其实并没有删除,只是对文件放置在一个服务器的目录里面,不过以后使用文件的时候你不可以看见而已.


$ ls
$ mv b.txt  b.java
$ ls
$ cvs remove b.txt


$ pwd
$ cd ..
$ pwd
$ cvs checkout -d other jul12_Project


更新的命令,-d包括新建立的目录.
$cvs update -d

/export/home/nanjing/sd0807/jul12


Tagging 标记
Branching分支标记
1.Making a Branch
    cvs rtag -b BR_1_0 cjProject
    cvs tag -b branch_tag_name [filename]
    or
    cvs rtag -b branch_tag_name [filename]
Branching Cont
    cvs checkout -r BR_1_0 -d br1.0

    $ cvs checkout -r BR_1_0 yoyodyne
    or
    $ cvs checkout -r BR_1_0 -d br1.0 yoyodyne


cvs diff -r1.1 -r1.6 比较不同版本之间 --side -by -side 对照显示差别

第四章:Using CVS in Eclipse
界面使用,比命令方便多了.呵呵.
posted @ 2008-08-15 09:13  系咪噶  阅读(412)  评论(0编辑  收藏  举报