CVS流程

15. Example: Creating a new project from scratch

In this example a new project is started from scratch.

The project administrator must first create the CVS repository. In this example all project files will be stored in /home/projects/myproj and only the project members can access that directory. The project members must be in the grpname group. Please note how the "set-group-id" bit is set with the chmod command.

[Done on the CVS server]
# mkdir /home/projects/myproj
# mkdir /home/projects/myproj/cvsroot
# chgrp -R grpname /home/projects/myproj # change group
# chmod 2770 /home/projects/myproj # make group writable
# cvs -d /home/projects/myproj/cvsroot init # create the repository

or

[Done remotely]
# ssh mylogin@host.name.com mkdir -p /home/projects/myproj/cvsroot
# ssh mylogin@host.name.com chgrp -R grpname /home/projects/myproj
# ssh mylogin@host.name.com chmod 2770 /home/projects/myproj
# cvs -d mylogin@host.name.com:/home/projects/myproj/cvsroot init

Next we need an empty directory which will be imported as a new "project". The project is called src in the following example. Please note that foo and bar are required but not really used as the imported directory is empty.

# mkdir /tmp/src
# cd /tmp/src
# cvs -d johndoe@host.name.com:/home/projects/myproj/cvsroot \
import -m "" src foo bar

The project members can now start to add new files and make changes to files created by other members. New files can be added with cvs add filename, existing files modified and unwanted files removed with cvs rm -f filename. Modifications to the source tree should be reviewed with cvs diff -u before checking in the changes with cvs ci.

# cvs -d johndoe@host.name.com:/home/projects/myproj/cvsroot co src
# cd src
# vi extension.c
# cvs add extension.c # add a new file
# vi existingfile.c # modify an existing file
# cvs rm -f TODO # remove an existing file
# cvs update -dPA # what files were changed?
# cvs diff -u | less # see the modifications
# cvs ci -m "All TODOs implemented" TODO # remove the TODO file
# cvs ci -m "Added support for XYZ" # check in other files
# cvs update -dPA # update all files

16. Example: Project with third-party sources

In this example a new project is started based on some existing code. The code used in this project is Foo version 1.0.

The project administrator must first create the CVS repository. In this example all project files will be stored in /home/projects/myproj and only the project members can access that directory. The project members must be in the grpname group. Please note how the "set-group-id" bit is set with the chmod command.

[Done on the CVS server]
# mkdir -p /home/projects/myproj/cvsroot
# chgrp -R grpname /home/projects/myproj # change group
# chmod 2770 /home/projects/myproj # group writable
# cvs -d /home/projects/myproj/cvsroot init # create the repository

or

[Done remotely]
# ssh mylogin@host.name.com mkdir -p /home/projects/myproj/cvsroot
# ssh mylogin@host.name.com chgrp -R grpname /home/projects/myproj
# ssh mylogin@host.name.com chmod 2770 /home/projects/myproj
# cvs -d mylogin@host.name.com:/home/projects/myproj/cvsroot init

After creating an empty repository the project administrator must import the original Foo 1.0 sources into the FOO vendor branch. These source files will be located in the src/foo directory.

# cd /tmp
# tar xzf foo-1.0.tar.gz # extract the original files
# cd foo-1.0
# cvs -d mylogin@host.name.com:/home/projects/myproj/cvsroot import \
-I ! -I CVS -ko -m "Imported Foo 1.0" src/foo FOO FOO-1_0

The project members can now check out their own working copies and start making modifications and improvements. New files can be added with cvs add filename, existing files modified and unwanted files removed with cvs rm -f filename. Modifications to the source tree should be reviewed with cvs diff -u before checking in the changes with cvs ci.

# cvs -d johndoe@host.name.com:/home/projects/myproj/cvsroot co -P src
# cd src
# vi extension.c
# cvs add extension.c # add a new file
# vi existingfile.c # modify an existing file
# cvs rm -f config.log # remove an existing file
# cvs update -dPA # what files were changed?
# cvs diff -u | less # see the modifications
# cvs ci -m "Removed configuration log" config.log # remove the log file
# cvs ci -m "Added support for XYZ" # check in other files
# cvs update -dPA # update all files

Later when Foo 1.1 is released the project administrator can import the new release into the repository and merge changes made between versions 1.0 and 1.1 into the main developement branch (also known as HEAD).

[Import the new release]
# cd /tmp
# tar xzf foo-1.1.tar.gz # extract the new files
# cd foo-1.1
# cvs -d mylogin@host.name.com:/home/projects/myproj/cvsroot import \
-I ! -I CVS -ko -m "Imported Foo 1.1" src/foo FOO FOO-1_1

[Merge changes between official 1.0 and 1.1 releases into HEAD]
# cd ~/src/foo
# cvs update -d -kk -j FOO-1_0 -j FOO-1_1 # merge between 1.0 and 1.1
# cvs update | grep ^C # any conflicts?
[Fix possible conflicts]
# cvs ci -m "Upgraded Foo to version 1.1" # check in changes
# cvs update -dPA # update all files

Next time the project members update their working copies they will get the new Foo 1.1 sources.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值