introduction to cvs 12/17/20151umbc cmsc 341. outline introduction to source code management what is...

31
Introduction to Introduction to CVS CVS 06/12/22 1 UMBC CMSC 341

Upload: matthew-mclaughlin

Post on 18-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Introduction to Introduction to CVSCVS

04/21/23 1UMBC CMSC 341

Page 2: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Outline• Introduction to Source Code Management

• What is CVS?

• CVS for Project Submission• Basic commands

• Checkout, Add, Commit, Update◦ How to use CVS using Putty◦ How to use CVS using Eclipse

04/21/23 UMBC CMSC 341 2

Page 3: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

What is Source Code Management

• SCM : Also known as revision or source control

• So, why should you use one?

04/21/23 UMBC CMSC 341 3

Page 4: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

What is CVS?

• Concurrent Versioning System (CVS) is one of the earlier SCM systems which gained wide adoption

• Advantages– Open source– Easy to install and use– Simple command line client– Wide integration in a lot of development

tools

04/21/23 UMBC CMSC 341 4

Page 5: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

CVS for Project submissionCVS for Project submissionTerminology used

◦Repository◦Server◦Client◦Working Directory

Some of the options available to connect to the repository◦Command-line using Putty◦Through Eclipse IDE

04/21/23 5UMBC CMSC 341

Page 6: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

CVS CommandCVS Command• The general form of CVS commands is:

– All CVS commands start out with “cvs”– 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

04/21/23 UMBC CMSC 341 6

cvs [cvs-options] command [command-options-and-arguments]

Page 7: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Basic commandsBasic commandscheckout : Pull resources from the

repository and create a working copy

add : place a resource under version control

update : Pull down changes from the repository into your working copy

commit: Check files into the repository

04/21/23 UMBC CMSC 341 7

Page 8: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Command-line using Putty

Steps to be followed◦ Log in using Putty◦ Edit the .cshrc file : Add alias javac

usr/local/bin/javac

04/21/23 UMBC CMSC 341 8

Page 9: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Command-line using PuttyCommand-line using PuttyStep 1: cd changes your working directory

to home directoryStep 2: cvs -d

/afs/umbc.edu/users/y/p/ypeng/pub/cs341s11/Proj0 checkout -d MyProj0 your_usernameYou will get two files copied to MyProj0: a junk and a build file

04/21/23 9UMBC CMSC 341

Page 10: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Command-line using PuttyCommand-line using Putty Step 3: cd MyProj0 Change to your project

directory Step 4 : mkdir src Step 5: cd src Step 6: Create a java file called Proj0.java and type in

a simple java code. Let the package name be ‘firstproject’. Save the file in the src folder.

04/21/23 UMBC CMSC 341 10

Page 11: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Build fileBuild file

04/21/23 11UMBC CMSC 341

Step 3: cd MyProj0 Change to your project directoryStep 4 : mkdir src

Step 7: if the build file you checked out is build.txt, then

mv build.txt build.xml Step 8 : edit build.xml (change the value of main.class)

Page 12: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Command-line using PuttyCommand-line using Putty Step 9: Compile the code using

ant compile Step 10: Run the code using

ant run

04/21/23 UMBC CMSC 341 12

Page 13: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Command-line using PuttyCommand-line using Putty Step 11 : Add files to the repository:

◦ Step 11.1 cvs add build.xml

◦ Step 11.2 cvs add src/

◦ Step 11.3 cd src

◦ Step 11.4 cvs add Proj0.java

◦ Step 11.5 cvs commit –m ‘some text’

04/21/23 UMBC CMSC 341 13

Page 14: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Command-line using PuttyCommand-line using PuttyStep 12: Check if Proj0.java is added to the

repository◦ Go to src folder in MyProj0◦ Remove Proj0.java◦ Run ‘cvs update’◦ You should get back Proj0.java from the

repository

04/21/23 UMBC CMSC 341 14

Page 15: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

EclipseEclipseEclipse has a built-in perspective

for CVS◦All of the developer downloads come

with it pre-installed

(The following directions are for the Eclipse Ganymede Eclipse IDE for Java Developer

release)

Page 16: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – CVS PerspectiveEclipse – CVS PerspectiveTo open the CVS repository

perspective select Window Open Perspective Other…

Page 17: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – CVS PerspectiveEclipse – CVS PerspectiveSelect CVS Repository Exploring

Page 18: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Adding a Eclipse – Adding a RepositoryRepositoryTo add a repository, right click on the CVS

Repositories pane and select New Repository Location…

Page 19: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Connection Eclipse – Connection SettingsSettingsType in the parameters to

connect to the remote repositoryFor example…

◦ Host: linux.gl.umbc.edu◦ Repository Path:

/afs/umbc.edu/users/y/p/ypeng/pub/cs341s11/Proj0/◦ User: Your GL/myUMBC username◦ Password: Your GL/myUMBC password◦ Connection type: extssh

Save the password if you wish

Page 20: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Connection Eclipse – Connection SettingsSettings

Page 21: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Viewing Eclipse – Viewing RepositoriesRepositoriesYou should now see the repository

under the CVS Repositories Pane

Page 22: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Checking OutEclipse – Checking OutExpand the repository, expand HEAD, select

your module (username) then right click and choose Check Out As…

Page 23: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Checking Out Eclipse – Checking Out (continued)(continued)Be sure to use the New Project Wizard,

click Finish…

Page 24: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Checking Out Eclipse – Checking Out (continued)(continued)Select to check out the module

as a Java Project

Page 25: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Checking Out Eclipse – Checking Out (continued)(continued)Name the project and click

Finish…

Page 26: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Checked Out Eclipse – Checked Out CodeCodeSwitch back to the Java Perspective

and you will see the module checked out as a project◦ Note the little orange cylinders – that

indicates that it’s under version control

Page 27: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – New ResourcesEclipse – New Resources• Just like with the command line, items

that are not know to be under CVS control are marked with a “?” symbol– Such as the Eclipse generated src folder

Page 28: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – SynchronizingEclipse – SynchronizingTo commit to or update from the repository,

right click on the project and choose Team Synchronize with Repository

Page 29: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – Committing Eclipse – Committing ResourcesResourcesHere we see an outgoing arrow indicating

that this needs to be pushed to the repository◦ Commits and updates can be performed by right

clicking

Page 30: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Eclipse – SynchronizedEclipse – SynchronizedIf all is in sync, you should see the “No

Changes” dialog as shown below…

Page 31: Introduction to CVS 12/17/20151UMBC CMSC 341. Outline Introduction to Source Code Management What is CVS? CVS for Project Submission Basic commands Checkout,

Thank you!Thank you!

04/21/23 UMBC CMSC 341 31