Dedian |
|
|||
-- 關(guān)注搜索引擎的開發(fā) |
日歷
統(tǒng)計
導(dǎo)航常用鏈接留言簿(8)隨筆分類(45)
隨筆檔案(82)
文章檔案(2)Java Spaces搜索積分與排名
最新評論
閱讀排行榜評論排行榜 |
--? Getting Ready to Use CVSFirst set the variable CVSROOT to /class/`username`/cvsroot[Or any other directory you wish] [For csh/tcsh: setenv CVSROOT ~/cvsroot] [For bash/ksh: CVSROOT=~/cvsroot;export CVSROOT] Next run cvsinit. It will create this directory along with the subdirectory CVSROOT and put several files into CVSROOT. -- How to put a project under CVSA simple program consisting of multiple files is in /workspaces/project.To put this program under cvs first cd to /workspaces/project Next cvs import -m "Sample Program" project sample start CVS should respond with N project/Makefile N project/main.c N project/bar.c N project/foo.c No conflicts created by this import If your were importing your own program, you could now delete the original source. (Of course, keeping a backup is always a good idea) -- Basic CVS UsageNow that you have added 'project' to your CVS repository, you will want to be able to modify the code.To do this you want to check out the source. You will want to cd to your home directory before you do this. cd cvs checkout project CVS should respond with cvs checkout: Updating project U project/Makefile U project/bar.c U project/foo.c U project/main.c This creates the project directory in your home directory and puts the files: Makefile, bar.c, foo.c, and main.c into the directory along with a CVS directory which stores some information about the files. You can now make changes to any of the files in the source tree. Lets say you add a printf("DONE\n"); after the function call to bar() [Or just cp /class/bfennema/project_other/main2.c to main.c] Now you have to check in the new copy cvs commit -m "Added a DONE message." main.c CVS should respond with Checking in main.c; /class/'username'/cvsroot/project/main.c,v <-- main.c new revision: 1.2; previous revision: 1.1 done Note, the -m option lets you define the checking message on the command line. If you omit it you will be placed into an editor where you can type in the checking message. -- Using CVS with Multiple DevelopersTo simulate multiple developers, first create a directory for your second developer.Call it devel2 (Create it in your home directory). Next check out another copy of project.
[Or copy /class/bfennema/project_other/bar2.c to bar.c] Next, check in bar.c as developer two.
[Probably /class/'username'/project] Now look at bar.c. As you can see, the change made by developer one has no been integrated into your version. For that to happen you must cvs update bar.c CVS should respond with U bar.c Now look at bar.c. It should now be the same as developer two's. Next, edit foo.c as the original developer and add printf("YOU\n"); after the printf("FOO\n"); [Or copy /class/bfennema/project_other/foo2.c to foo.c] Then check in foo.c
Add printf("TOO\n"); after the printf("FOO\n"); [Or copy /class/bfennema/project_other/foo3.c to foo.c] Now type cvs status foo.c CVS should respond with =================================================================== File: foo.c Status: Needs Merge Working revision: 1.1.1.1 'Some Date' Repository revision: 1.2 /class/'username'/cvsroot/project/foo.c,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)The various status of a file are: Up-to-date
Therefore, this is telling use we need to merge our changes with the changes made by developer one. To do this cvs update foo.c CVS should respond with RCS file: /class/'username'/cvsroot/project/foo.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 Merging differences between 1.1.1.1 and 1.2 into foo.c rcsmerge: warning: conflicts during merge cvs update: conflicts found in foo.c C foo.c Since the changes we made to each version were so close together, we must manually adjust foo.c to look the way we want it to look. Looking at foo.c we see: void foo() { printf("FOO\n"); <<<<<<< foo.c printf("TOO\n"); ======= printf("YOU\n"); >>>>>>> 1.2 } We see that the text we added as developer one is between the ======= and the >>>>>>> 1.2. The text we just added is between the ======= and the <<<<<<< foo.c To fix this, move the printf("TOO\n");to after the printf("YOU\n");line and delete the additional lines the CVS inserted. [Or copy /class/bfennema/project_other/foo4.c to foo.c] Next, commit foo.c cvs commit -m "Added TOO" foo.c Since you issued a cvs update command and integrated the changes made by developer one, the integrated changes are committed to the source tree. -- Additional CVS CommandsTo add a new file to a module:
Removing files from a module:
For more information see the cvs man pages or the cvs.ps file in cvs-1.7/doc. --------------- copy from http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/
|
![]() |
|
Copyright © Dedian | Powered by: 博客園 模板提供:滬江博客 |