Dedian  
          -- 關注搜索引擎的開發
          日歷
          <2006年7月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345
          統計
          • 隨筆 - 82
          • 文章 - 2
          • 評論 - 228
          • 引用 - 0

          導航

          常用鏈接

          留言簿(8)

          隨筆分類(45)

          隨筆檔案(82)

          文章檔案(2)

          Java Spaces

          搜索

          •  

          積分與排名

          • 積分 - 65633
          • 排名 - 816

          最新評論

          閱讀排行榜

          評論排行榜

           

          --? Getting Ready to Use CVS

          First 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 CVS

          A 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 Usage

          Now 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 Developers

          To 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.
          • HINT: cvs checkout project
          Next, in the devel2/project directory, add a printf("YOU\n"); after the printf("BAR\n");
          [Or copy /class/bfennema/project_other/bar2.c to bar.c]

          Next, check in bar.c as developer two.
          • HINT: cvs commit -m "Added a YOU" bar.c
          Now, go back to the original developer directory.
          [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

          • HINT: cvs commit -m "Added YOU" foo.c
          Next, cd back to developer two's directory.
          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
            The file is identical with the latest revision in the repository.
          Locally Modified
            You have edited the file, and not yet committed your changes.
          Needing Patch
            Someone else has committed a newer revision to the repository.
          Needs Merge
            Someone else has committed a newer revision to the repository, and you have also made modifications to the file.

          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 Commands

          To add a new file to a module:
          • Get a working copy of the module.
          • Create the new file inside your working copy.
          • use cvs add filename to tell CVS to version control the file.
          • use cvs commit filename to check in the file to the repository.

          Removing files from a module:
          • Make sure you haven't made any uncommitted modifications to the file.
          • Remove the file from the working copy of the module. rm filename.
          • use cvs remove filename to tell CVS you want to delete the file.
          • use cvs commit filename to actually perform the removal from the repository.

          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/
          posted on 2006-07-20 07:06 Dedian 閱讀(512) 評論(0)  編輯  收藏 所屬分類: Java Memo
           
          Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 永新县| 万安县| 遵化市| 新绛县| 井研县| 绥棱县| 万源市| 屏东市| 阿图什市| 临沂市| 章丘市| 汝南县| 郑州市| 青州市| 南陵县| 汤阴县| 凤台县| 沙田区| 韩城市| 玉山县| 娄烦县| 东方市| 崇明县| 台北市| 台江县| 桐城市| 墨竹工卡县| 修文县| 石柱| 五河县| 民权县| 淳化县| 中西区| 阳曲县| 鄱阳县| 拜泉县| 肇源县| 巴彦淖尔市| 义乌市| 晋城| 秀山|