免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 916 | 回复: 0
打印 上一主题 下一主题

cvs and rcs [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-09 10:01 |只看该作者 |倒序浏览

               
               
                CVS(concurrent version system,并发版本系统) and RCS(revision control system,修订控制系统)
RCS
1、首先,先建一个目录rcs:
   mkdir rcs
2、在rcs目录下编写一个程序,如test.c
3、执行命令$ci test.c,将会提示你输入文件的描述信息,首次检入时,还可用-i选项,ci(check in)
4、读出test.c,并进行修改co(check out)
   $co -l test.c
   只有锁定后才能修改,因为rcs是一个源代码库,-l display lock
找出rcs文件的不同,有rcsdiff command, rcsdiff的命令参数和diff的相同
rcsclean做删除工作
CVS
在导入时,当前的工作目录不能为CVSROOT所在的目录。
创建过程
1、创建源代码库,并初始化
   $cvs -d $HOME/cvs init
   init表示初始化,在当前主目录下,新建了一个目录cvs,这里的目录($HOME/cvs)只是一个例子,一般是不会放在这里,-d指定了要初始化的源代码库,成功后,里面会有一个目录CVSROOT,一旦完成初始化工作,立即设置环境变量$CVSROOT,把它指向这个目录。如果不在执行shell,可用export CVSROOT=$HOME/cvs,最好把这个变量放到shell的初始化文件中
2、将你的源代码交给CVS控制。最简单的做法是使用CVS的import命令。
import的语法是:
csv import [-d] [-k subset] [-I ign] [-m msg] [-b branch] [-w spec] repository vendor-tag release-tags...
export命令的选项和参数
  -I ign    忽略文件列表
  -b bra    指定开发商的分支ID
  -m msg    记录导入时的消息
  repository   从源代码库repository中导入文件
  vendor-tag   是源代码提供者的名字
  release-tag   指定用于某个特殊发布的符号名
    * -D DATE   - Exports the latest revisions no later than DATE.
    * -d DIR   - Exports into DIR (otherwise, defaults to the module name).
    * -f    - Forces use of head revisions, if a given tag or date would result in nothing being found (for use with -D or -r).
    * -k MODE - Expands RCS keywords according to MODE. (See the section Keyword Substitution (RCS Keywords) later in this chapter.)
    * -l   - Local. Exports only the top level of the project, no subdirectories.
    * -N   - Doesn't "collapse" empty intermediate directories. This option is like the -N option to checkout (see checkout).
    * -n    - Does not run a module program as may be specified in CVSROOT/modules. (See Repository Administrative Files later in this chapter for more about this.)
    * -P   - Prunes empty directories (like the -P option to checkout or update).
    * -R   - Recursive. Exports all subdirectories of the project (the default). The only reason to specify -R is to counteract a -l in a .cvsrc file.
    * -r REV   - Exports revision REV. REV is almost certainly a tag name, not a numeric revision.
   
3、将你的源代码(project_name)既可以是目录,也可以是文件,传到CVS库
     #cvs import -m "write some comments here for you create project" project_name verder_tag  release_tag
4、导出文件
     #cvs co project_name   or #cvs checkout project_name
将改动合并进源代码库
首先你得确保其它开发人员对你正在编辑的文件所做的停止以也已经反映到你的源代码上了,这叫作让你的工作文件和源代码库同步。接下来,把改动提交给源代码库。
假设你已经编辑好了yo.c。要把工作目录同源代码库进行同步操作,需在你的工作服目录下update命令。
$cvs update
  cvs update: Updating/
  RCS file:/home/kwal/cvs/yo.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  Merging differences between 1.2 and 1.3 into yo.c
  M yo.c
这里显示地表明了有人改变了yo.c,最后一行M yo.c表示你所做的修改其它的人还不能看到

现在提交你作的修改
$cvs commit yo.c
5.检查改动
  检查一个文件的修改历史
  $cvs log yo.c
6、添加和删除文件
   1)创建文件
   2)用add添加
   3)用commit提交
   example: have file yo.h
   $cvs add yo.h
   $cvs commit -m "add a head file" yo.h
   删除文件
   $rm main.c
   $cvs rm main.c
   $cvs commit
   只有你使用了commit命令,你所作的更改在库中才会正式生效,如上面的删除,如没有执行cvs commit命令,main.c在cvs库中是不会被删除的
7、通过ssh远程使用cvs库   
   Note
Replace  with the IP address or host name of the CVS repository machine. You will be prompted for the user's shell account password before CVS checkout can continue.
export CVS_RSH=/usr/bin/ssh
cvs -d:ext:servername>:/srv/cvs co cvstest
cvstest 代表你当前工作的目录,或是你想存放文件的目录
如果你在shell下输入‘cvs programme_name’,将会得到如下的参数结果,如:$cvs test.c
CVS commands are:
        add          Add a new file/directory to the repository
        admin        Administration front end for rcs
        annotate     Show last revision where each line was modified
        checkout     Checkout sources for editing
        commit       Check files into the repository
        diff         Show differences between revisions
        edit         Get ready to edit a watched file
        editors      See who is editing a watched file
        export       Export sources from CVS, similar to checkout
        history      Show repository access history
        import       Import sources into CVS, using vendor branches
        init         Create a CVS repository if it doesn't exist
        kserver      Kerberos server mode
        log          Print out history information for files
        login        Prompt for password for authenticating server
        logout       Removes entry in .cvspass for remote repository
        pserver      Password server mode
        rannotate    Show last revision where each line of module was modified
        rdiff        Create 'patch' format diffs between releases
        release      Indicate that a Module is no longer in use
        remove       Remove an entry from the repository
        rlog         Print out history information for a module
        rtag         Add a symbolic tag to a module
        server       Server mode
        status       Display status information on checked out files
        tag          Add a symbolic tag to checked out version of files
        unedit       Undo an edit command
        update       Bring work tree in sync with repository
        version      Show current CVS version(s)
        watch        Set watches
        watchers     See who is watching a file


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/45689/showart_681742.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP