此项的配置主要是要注意这几选项:
第一,Checkout read-only不要选上,否则,checkout出来的源代码将不允许用户进行
修改,并且此选项默认是选中的;
第二,Prune (remove) empty directories也不要选上,否则,会自动删除空目录;
第三,对一般配置没有特殊要求的,把Dirty files support、Supply control when adding
与TCP/IP compression选项选中;
4、登录服务器:
选择Admin->;login,将出现如下对话框要求用户输入登录口令
输入口令后,选择“OK”按钮,如果CVS服务器与WinCVS的配置都没出错的话,将在CVS的状态栏中提示:
cvs -z9 -d :pserver:cvsyxwu@10.104.1.204:/home/cvsroot login
Logging in to :pserver:cvsyxwu@10.104.1.204:2401/home/cvsroot
***** CVS exited normally with code 0 *****
code 0表示正确的登录;而如果出错的话,将是code 1,那么要根据错误的提示进行相应的修改。
5、从CVS服务器上check out相应的模块:
第一,在workspace中的Modules选中要存放checkout模块的目录;
第二,选择Create->;Checkout Modeles,将出现如下对话框:
其中,Module name and path on the server就是要存放checkout 内容的目录,由用户输入;而Local folder to checkout to就是第一中用户所选择的目录。
6、修改之后把文件提交到CVS服务器
a)、只有一个用户对文件进行修改的情况
用自己喜欢的编辑器对checkout出来的文件进行修改,修改之后的文件在没有提交之前会是红色的,如下图example.h文件:
选中红色的文件example.h后右击选择“Commit Selection”选项,如果没有其它用户也对其进行修改并已经提交到CVS服务器上,一切正常的话将把example.h文件提交到CVS服务器并把图标恢复成原来的颜色。
b)、两个或两个以上的用户对同一文件的不同部分进行修改的情况
这种情况就是如用户A与用户B都checkout了文件example.h,内容如下:
int callby (int count)
{
printf("ExcelStor!\n";
}
void main(int argv,char *argc)
{
//added by my cvs
printf("I am Cather\n";
}
int mainexample()
{
printf("OK\n";
}
然后用户A修改成如下,并提交到CVS服务器(一般将正常提交):
int callby (int count)
{//add
printf("ExcelStor!\n";
}
void main(int argv,char *argc)
{
//added by my cvs
printf("I am Cather\n";
}
int mainexample()
{//add
printf("OK\n";
}
接着用户B修改成如下:
int callby (int count)
{//add
printf("ExcelStor!\n";
}
void main(int argv,char *argc)
{
//modified
printf("I am Cather\n";
}
int mainexample()
{//add
printf("OK\n";
}
当用户B选择“Commit Selection”时将提示:
cvs server: Up-to-date check failed for `example.h'
cvs [server aborted]: correct above errors first!
此时表明已经有用户对同一个文件example.h进行修改并提交到CVS服务器,这时
要先选择“Update Selection”对本地example.h与CVS服务器上的example.h文件进行
同步与合并,不用选中出现的任何选项,直接选择“OK”,这时将显示如下:
cvs -z9 update example.h (in directory C:\my cvs\STW\src\)
RCS file: /home/cvsroot/STW/src/example.h,v
retrieving revision 1.5
retrieving revision 1.6
Merging differences between 1.5 and 1.6 into example.h
M example.h
***** CVS exited normally with code 0 *****
表明用户B与用户A的修改已经合并成功,同时文件example.h的图标也将变成红色,合并后的文件是存放在用户B的本地机上,为了更新到CVS服务器还必须选中example.h并右击选择“Commit Selection”才能把用户A与用户B的修改合并后的结果提交到CVS服务器上。注:M表示此文件已经被修改过。
c)、两个或两个以上的用户对同一个文件的相同部分进行修改的情况
这种情况就是如用户A与用户B都下载了文件example.h,内容如下:
void main(int argv,char *argc)
{
printf("I am Cather\n";
}
然后用户A把文件修改成如下,并提交到CVS服务器(一般将正常提交):
void main(int argv,char *argc)
{
printf("I am Cather\n");
printf("I am Pat\n");
}
接着用户B又把文件修改成如下:
void main(int argv,char *argc)
{
printf("I am Cather\n");
printf("I love you Cather\n");
}
如果用户B这时选择“Commit Selection”准备把修改结果提交到CVS服务器,此
时将显示如下的错误提示:
cvs -z9 commit -m "update in 11:20" example.h (in directory C:\my cvs\STW\src\)
cvs server: Up-to-date check failed for `example.h'
cvs [server aborted]: correct above errors first!
***** CVS exited normally with code 1 *****
表明用户B的修改与其它用户的修改冲突,这时要先选择“Update Selection”,将显示如下提示:
cvs -z9 update example.h (in directory C:\my cvs\STW\src\)
RCS file: /home/cvsroot/STW/src/example.h,v
retrieving revision 1.9
retrieving revision 1.10
Merging differences between 1.9 and 1.10 into example.h
rcsmerge: warning: conflicts during merge
cvs server: conflicts found in example.h
C example.h
***** CVS exited normally with code 0 *****
example.h前面的C表示与其它用户的修改有冲突,并且文件的图标会加显示一个“C”,如下所示:
双击example.h将显示example.h的内容,如下:
void main(int argv,char *argc)
{
printf("I am Yanxi\n");
printf("I am Cather\n");
<<<<<<< example.h
printf("I love you Yanxi,too!\n"); //这部分为你的修改
=======
printf("I love you Cather!\n"); //这部分为其它用户的修改
>;>;>;>;>;>;>; 1.10
}
这时你应该与用户A进行协商以决定最终要怎样修改。比如,可以修改成:
void main(int argv,char *argc)
{
printf("I am Yanxi\n");
printf("I am Cather\n");
printf("I love you Yanxi,too!\n"); //这部分为你的修改
printf("I love you Cather!\n"); //这部分为其它用户的修改
}
然后选择“Commit Selection”进行提交,将显示如下的提示信息:
cvs -z9 commit -m "update in 11:20" example.h (in directory C:\my cvs\STW\src\)
Checking in example.h;
/home/cvsroot/STW/src/example.h,v <-- example.h
new revision: 1.11; previous revision: 1.10
done
***** CVS exited normally with code 0 *****
表明用户A与用户的修改已经合并成功。