每个帐户必须单独操纵自己的工作目录,即使无法co文件也不能临时用别人的帐号来co,以免以后的操作会出现问题
基本步骤:
set CVSROOT=:pserver:username@yourIP/sources
username=yourUsername passwd=********
cvs login
cvs co/ci等等
导入代码
cvs import [-options] repository vendortag releasetag...
比如我们要将本地test目录的文件导入到仓库中的test文件夹中就执行cvs import -m "message" test v_0_0_1 start,在message处换成你自己的注释,test为仓库中的文件夹名,后面两个没什么用,分别为vendortag和releasetag。import的另一用法见下面添加文件
添加文件
创建好新文件后,比如:touch new_file
cvs add new_file
注意:对于图片,Word文档等非纯文本的项目,需要使用cvs add -kb选项按2进制文件方式导入(k表示扩展选项,b表示binary),否则有可能出现文件被破坏的情况
比如:
cvs add -kb new_file.gif
cvs add -kb readme.doc
然后确认修改并注释
cvs ci -m "write some comments here"
add只适用于加少量文件,当要加的为文件夹且其底下有很多子文件夹和文件时就很不方便,这时可以用import代替。比如本地test2目录下有很多文件夹要加到仓库中的test/test2底下,则可以进入本地test2文件夹,执行cvs import -m "message" test/test2 vendortag releasetag
注意mkdir test;cd test;cvs co docs/winceboard和cvs co -d test docs/winceboard的不同
导入CVS的文件名都要改为英语,以方便下载。
添加用户:cvs passwd -a -r realsystemuser theuser
删除用户:cvs passwd -X theuser
删除文件:cvs remove -f testfile; cvs ci testfile
review:可以用cvs status -q来看哪些文件夹被修改了,用cvs diff来看具体改了些什么
tag file:cvs tag test_tag testfile(directoris will be included recursively)
branch file:cvs tag -b test_tag testfile(directoris will be included recursively)
get tagged/branched files: cvs co -r test_tag testfile 或者cvs update -r test_tag testfile,对tag/branch'出来的文件所做的修改不会放入HEAD里
del tag:cvs tag -d test_tag testfile
Merge branch:cvs co testfile; cvs update -j test_tag testfile; cvs ci,用于将branch里的改动加到HEAD中。
项目目录管理:在sources下用cvs chacl -a read,nowrite,nocontrol,notag,nocreate -u theuser . 将使theuser对所有文件只具备读权限,通过更改可使其拥有其它权限。
diff: cvs diff -u8p FILENAME
If, instead of using a regular file for FILENAME, you provide a directory, then this directory as well as all subdirectories will be searched recursively. For example : cvs diff -u8p . > OUT_FILE
To include a new file in your patch, use the -N option: cvs diff -u8pN . > OUT_FILE
patch( a linux command, not cvs command): patch -p0 < new.diff
If they're relative to a higher-level directory, you'd replace 0 with the number of higher-level directories in the path, e.g. if the names are "ethereal.orig/prefs.c" and "ethereal.mine/prefs.c", you'd run it with: patch -p1 < new.diff
If they're relative to a subdirectory of the top-level directory, you'd run "patch" in that directory and run it with "-p0".
If you run it without "-p" at all, the patch tool flattens path names, so that if you have a patch file with patches to "Makefile.am" and "wiretap/Makefile.am", it'll try to apply the first patch to the top-level "Makefile.am" and then apply the "wiretap/Makefile.am" patch to the top-level "Makefile.am" as well.