Wednesday, February 3, 2010

Linux: create a CVS repository on local machine


CVS is usually set up as client/server model to let developers from different locations work concurrently and submit their code to a central place for sharing. If you are the only developer and work on some small projects by yourself, you don't need to build such a complicated system. With several simple steps, you can use CVS on a stand-alone machine.

* Create a directory for the CVS repository to keep all the history of your work.
      mkdir -p /home/user1/cvs_repository

* Set some enviromental variables: CVSROOT tells where the repository is. EDITOR tells which editor you prefer.
      export CVSROOT=:local:/home/user1/cvs_repository
      export EDITOR=vi

* Initialize the repository.
      cvs init

* Set up an empty project in the repository. You can also import your existing project in this step, but you would still need to check out the project into a work directory for further development.
      mkdir -p /home/user1/empty_dir
      cd /home/user1/empty_dir
      cvs import myprojects vtag rtag
      cd ..
      rmdir empty_dir

* Set up a work directory for the project, and check out the project which is empty yet.
      mkdir -p /home/user1/work_dir
      cd /home/user1/work_dir
      cvs co myprojects

* Add directories and files to the project. Check in the changes into the CVS repository.
      mkdir project1
      cvs add project1
      cvs ci
      cd project1
      vi file1.txt
      cvs ci

No comments:

 
Get This <