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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 CVSPortions adapted from A Visual Guide to Version ControlOutline• 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 SSHWhat 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…• So, what exactly is in Foo.java.bak.bak?[Dan@icarus grocery-list]$ ls Foo*Foo.java Foo.java.DAN Foo.java.bak.bakFoo.java.1030am Foo.java.Sep-2-1030am Foo.java.oldFoo.java.10am Foo.java.WORKING_AS_OF_11amFoo.java.BROKEN Foo.java.bak[Dan@icarus grocery-list]$The “Shared Drive” Approach• Can’t we just write to a directory on the shared drive?• Where’s the eggs developer A added?– Problem gets worse as number of developers growsDeveloper A Developer BMilkMilkJuiceMilkEggsMilkMilkJuiceMilkMilkEggsopenopensavesaveUse 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 CVSCVS 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 repositoryCVS 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 repositoryCVS 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 neededCVS Command• The general form of CVS commands is:– 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-commandscvs [cvs-options] command [command-options-and-arguments]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-listcvs checkout: Updating grocery-list[Dan@icarus code]$ lsgrocery-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.javapackage 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…• Here the “?” character means that this is something that is in your working copy, but not under version control[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]$Adding Directories to Source Control• To add a directory to source control issue the “cvs add” command• 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 add src/Directory /srv/cvs/grocery-list/src added to the repository[Dan@icarus grocery-list]$[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…• 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 add src/edu/umbc/dhood2/GroceryList.javacvs add: scheduling file `src/edu/umbc/dhood2/GroceryList.java' for additioncvs add: use 'cvs commit' to add this file permanently[Dan@icarus grocery-list]$[Dan@icarus grocery-list]$ cvs -q updateA src/edu/umbc/dhood2/GroceryList.java[Dan@icarus


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 2 2 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?