DOC PREVIEW
UMBC CMSC 341 - Introduction to CVS

This preview shows page 1-2-3-4-5-33-34-35-36-66-67-68-69-70 out of 70 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 70 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Introduction to CVS Portions adapted from A Visual Guide to Version Control Outline Introduction to Source Code Management CVS CVS Terminology Setup Basic commands Checkout Add Commit Diff Update Remove Log Revert Other CVS items of interest Handling conflicts Ignoring certain resources Creating your own repositories Adding modules to a repository Popular clients TortoiseCVS Eclipse UNIX shell over SSH What is Source Code Management A source code management SCM system handles the management of revisions of resources Typically though not always source code So why should you use one The I ll Roll My Own Approach You ve probably seen or perhaps created messes like this Dan icarus grocery list ls Foo Foo java Foo java DAN Foo java 1030am Foo java Sep 2 1030am Foo java 10am Foo java WORKING AS OF 11am Foo java BROKEN Foo java bak Dan icarus grocery list Foo java bak bak Foo java old So what exactly is in Foo java bak bak The Shared Drive Approach Can t we just write to a directory on the shared drive Milk Milk Eggs Developer A open save Milk open Milk Milk Eggs Milk Juice save Milk Juice Developer B Where s the eggs developer A added Problem gets worse as number of developers grows Use in Industry Many development shops make use of some type of SCM system where there is a need for more discipline and management of source code Can you check to see if class Foo exhibits a particular bug in that release A B C from last spring we made for customer X for Linux specifically the i686 build and if so what other releases are also affected Though there are many different SCM systems out there the concepts remain pretty similar CVS Subversion Git ClearCase SourceSafe etc What is CVS Concurrent Versioning System CVS is one of the earlier SCM systems which gained wide adoption Open source Easy to install and use Simple command line client Wide integration in a lot of development tools For good introduction on version control and CVS see the following book Pragmatic Version Control using CVS CVS Terminology Repository the place where resources are stored Server the computer hosting the repository Client the computer connecting to the repository Working Set Copy your local copy of resources housed in the repository CVS Terminology Checkout pull down resources from the repository and create a working copy Checkin Commit place resources from your working copy into the repository Add place a resource under version control Remove delete a resource from version control Update pull down changes from the repository into your working copy Revert overwrite resources in your working copy with what is in the repository CVS Setup The following setup examples assume that you are using a standard CVS command line client and that the repository is accessible directly through the file system You need to specify where the repository resides this is typically specified as an environment variable bash shell export CVSROOT path to repo t csh shell setenv CVSROOT path to repo Alternatively you can specify the path to the repository with the d flag when needed CVS Command The general form of CVS commands is cvs cvs options command command options and arguments All CVS commands start out with cvs The cvs command must also have a command specified to execute such as checkout or commit Commands may also have flags and or arguments which modify their behavior For a more help General help cvs help List of commands cvs help commands CVS Checkout Command The cvs checkout command is used to checkout code from the repository The last argument is the name of the module you want to check out Dan icarus code cvs checkout grocery list cvs checkout Updating grocery list Dan icarus code ls grocery list Dan icarus code ls grocery list CVS Dan icarus code CVS Directory You will note a CVS directory when you check code out This is a directory that is utilized and managed by the CVS client You should not mess with any files within it Doing so may cause issues with the CVS client Dan icarus code ls grocery list CVS Dan icarus code Creating Directories and Files Create directories and edit files using whatever means you want Dan icarus grocery list mkdir p src edu umbc dhood2 Dan icarus grocery list emacs src edu umbc dhood2 GroceryList java Dan icarus grocery list Our Example Java File Dan icarus grocery list cat src edu umbc dhood2 GroceryList java package edu umbc dhood2 import java util LinkedList import java util List public class GroceryList public static void main String args List String list new LinkedList String list add Milk for String item list System out println item Dan icarus grocery list Checking Working Copy Status You can check the status of your working copy at any time by issuing the cvs q update command Dan icarus grocery list cvs q update src Dan icarus grocery list cvs add src Directory srv cvs grocery list src added to the repository Dan icarus grocery list Here the character means that this is something that is in your working copy but not under version control Adding Directories to Source Control To add a directory to source control issue the cvs add command Dan icarus grocery list cvs add src Directory srv cvs grocery list src added to the repository Dan icarus grocery list Checking the status now reveals that the edu subdirectory under src is unknown src has been added to the repository Need to repeat for subdirectories Dan icarus grocery list cvs q update src edu Dan icarus grocery list Adding Files to the Repository First you need to register the file as being under version control by using cvs add command Dan icarus grocery list cvs add src edu umbc dhood2 GroceryList java cvs add scheduling file src edu umbc dhood2 GroceryList java for addition cvs add use cvs commit to add this file permanently Dan icarus grocery list You can verify that it has been added by performing a cvs q update The A means that it has been added Dan icarus grocery list cvs q update A src edu umbc dhood2 GroceryList java Dan icarus grocery list Committing Changes Files that have been added your working copy can be committed to the repository with cvs commit The m flag can be used to enter a message otherwise the editor specified with the CVSEDITOR environment variable is used to author a message or a default editor is used Dan icarus grocery list cvs commit m initial list cvs commit Examining cvs commit Examining src cvs commit Examining src edu cvs commit Examining src edu umbc cvs commit Examining src edu umbc dhood2 RCS file srv cvs


View Full Document

UMBC CMSC 341 - Introduction to CVS

Download Introduction to CVS
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to CVS and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to CVS and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?