RCS作为非常古老的版本工具,远远在SVN和已经退役的CVS之前。它的古老程度应该比Web开发的ASP前代的CGI还要久远。但是作为非常简单的文本格式的版本管理工具,它使用时间跨度之久令人惊奇。如果想对版本管理实现方式进行深入研究的话,RCS提供了一种最为简单的方式,,v文件是RCS的全部,以文本形式存放,简单易读,对于想深入了解版本管理或者想开发类似工具的开发者来说,绝对是可以借鉴的。
安装
比如像centos等,新的centos7之前应该都是被缺省安装的。如果没有的话,yum install rcs即可。230k左右的package,可以完成很多的功能。
===================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================
Installing:
rcs x86_64 5.9.0-5.el7 base 230 k
Transaction Summary
===================================================================================================================================================
版本确认
[root@host31 ~]# rcs --version
rcs (GNU RCS) 5.9.0
Copyright (C) 2010-2013 Thien-Thi Nguyen
Copyright (C) 1990-1995 Paul Eggert
Copyright (C) 1982,1988,1989 Walter F. Tichy, Purdue CS
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@host31 ~]#
checkin命令:ci
准备
[root@host31 ~]# mkdir -p /local/testrcs
[root@host31 ~]# cd /local/testrcs
[root@host31 testrcs]# mkdir RCS
[root@host31 testrcs]# echo "#include <stdio.h>" >hello.h
checkin命令:ci
[root@host31 testrcs]# ci hello.h
RCS/hello.h,v <-- hello.h
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> initial version
>> .
initial revision: 1.1
done
[root@host31 testrcs]#
checkin后的确认,发现文件不见了,只有RCS下生成的,v文件了
[root@host31 testrcs]# ll
total 0
drwxr-xr-x. 2 root root 22 Aug 15 21:48 RCS
[root@host31 testrcs]# ll RCS
total 4
-r--r--r--. 1 root root 213 Aug 15 21:48 hello.h,v
[root@host31 testrcs]# cat RCS/hello.h,v
head 1.1;
access;
symbols;
locks; strict;
comment @ * @;
1.1
date 2016.08.15.17.47.54; author root; state Exp;
branches;
next ;
desc
@initial version
@
1.1
log
@Initial revision
@
text
@#include <stdio.h>
@
[root@host31 testrcs]#
再看hello.h,v文件你会清晰地发现版本