ITPub博客

首页 > 应用开发 > IT综合 > CVS笔记

CVS笔记

原创 IT综合 作者:kujoin 时间:2007-03-09 15:26:22 0 删除 编辑

"Concurrent Versions System" (CVS) is a version-control system that helps programmers and authors keep histories of their files.

[@more@]

"Concurrent Versions System" (CVS) is a version-control system that helps programmers and authors keep histories of their files.

passwd file

Here is an example passwd file with five entries:

anonymous:
bach:ULtgRLXo7NRxs
spwang:1sOp854gDF3DY
melissa:tGX1fS8sun6rY:pubcvs
qproj:XR4EZcEs0szik:pubcvs

(The passwords are encrypted according to the standard Unix crypt() function, so it is possible to paste in passwords directly from regular Unix /etc/passwd files.)

The first line in the example will grant access to any cvsnt client attempting to authenticate as user anonymous, no matter what password they use, including an empty password. (This is typical for sites granting anonymous read-only access; for information on how to do the "read-only" part, see the section called “Read-only repository access ”.)

CVS权限:
c - create - create and delete files and directories
r - read   - retrieve file and look at information
w - write  - modify files and change information
n - none   - no access allowed

cvs chacl theuser:rw dir1 dir2 dir3

创建group file:

group1: user1 user2 user3

group2: me you dognamedblue

group3: peter paul mary

注意:Repository administrators are automatically made a member of the group 'admin'. Don't list this group in the group file.

If SystemAuth = No only the CVSROOT/admin file is checked.

创建readers and writers 文件:

$CVSROOT/CVSROOT/readers file or $CVSROOT/CVSROOT/writers .Here is a sample readers file:

melissa
splotnik
jrandom

(Don't forget the newline after the last user.)

If readers exists, and this user is listed in it, then she gets read-only access. Or if writers exists, and this user is NOT listed in it, then she also gets read-only access (this is true even if readers exists but she is not listed there). Otherwise, she gets full read-write access.

创建分支(Creating a branch)

You can create a branch with tag -b; for example, assuming you're in a working copy:

$ cvs tag -b rel-1-0-patches

You can also create a branch without reference to any working copy, by using rtag:

$ cvs rtag -b -r rel-1-0 rel-1-0-patches tc

Accessing branches

To check out a branch from the repository, invoke checkout with the -r flag, followed by the tag name of the branch (the section called “Creating a branch ”):

$ cvs checkout -r rel-1-0-patches tc

Or, if you already have a working copy, you can switch it to a given branch with update -r:

$ cvs update -r rel-1-0-patches tc

or equivalently:

$ cd tc
$ cvs update -r rel-1-0-patches

Merging from a branch several times

+-----+    +-----+    +-----+    +-----+    +-----+
! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
+-----+    +-----+    +-----+    +-----+    +-----+
                !                           *
                !                          *
                !   +---------+    +---------+    +---------+
Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
                    +---------+    +---------+    +---------+

So instead you need to specify that you only want to merge the changes on the branch which have not yet been merged into the trunk. To do that you specify two -j options, and cvsnt merges the changes from the first revision to the second revision. For example, in this case the simplest way would be

cvs update -j 1.2.2.2 -j R1fix m.c    # Merge changes from 1.2.2.2 to the
                                    # head of the R1fix branch

Merging differences between any two revisions

With two -j revision flags, the update (and checkout) command can merge the differences between any two revisions into your working file.

$ cvs update -j 1.5 -j 1.3 backend.c

移动和重命名(Moving and renaming files)

The Normal way to Rename

The normal way to move a file is to copy old to new, and then issue the normal cvsnt commands to remove old from the repository, and add new to it.

$ mv old new
$ cvs remove old
$ cvs add new
$ cvs commit -m "Renamed old to new" old new

This is the simplest way to move a file, it is not error-prone, and it preserves the history of what was done. Note that to access the history of the file you must specify the old or the new name, depending on what portion of the history you are accessing. For example, cvs log old will give the log up until the time of the rename.

When new is committed its revision numbers will start again, usually at 1.1, so if that bothers you, use the -r rev option to commit. For more information see the section called “Assigning revisions ”.

Moving the history file

This method is more dangerous, since it involves moving files inside the repository. Read this entire section before trying it out!

$ cd $CVSROOT/dir
$ mv old,v new,v

When to commit?

It is common to only commit files after making sure that they can be compiled.

File or project 的status:

1. up-to-date:表示和仓库中的最新版相同

2. locally modified:表示你已经封它修改,但尚未作check in

3. needing patch:表示有人已经放入新版本到仓库中

4. needing merge:表示有人已经放入新版本到仓库中,而你也封自己目录下的文件作过修改

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7200963/viewspace-903640/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: CVS VS VSS
请登录后发表评论 登录
全部评论

注册时间:2008-10-27

  • 博文量
    5
  • 访问量
    158151