Introduction to CVS Concurrent Versions System 2282021 Peter

  • Slides: 28
Download presentation
Introduction to CVS: Concurrent Versions System 2/28/2021 Peter Cappello cappello@cs. ucsb. edu

Introduction to CVS: Concurrent Versions System 2/28/2021 Peter Cappello cappello@cs. ucsb. edu

cappello@cs. ucsb. edu 2/28/2021 What is CVS? l A version control system: – A

cappello@cs. ucsb. edu 2/28/2021 What is CVS? l A version control system: – A change history for a file set l Open-source l CVS as a: – local version control system – Internet client/server version control system

cappello@cs. ucsb. edu 2/28/2021 What is CVS? … l CVS uses unreserved check-outs: –

cappello@cs. ucsb. edu 2/28/2021 What is CVS? … l CVS uses unreserved check-outs: – Check out ! exclusive write permission. • Many developers can concurrently: – – – check out a file modify it check it back in. CVS automatically merges changes. l CVS can't safely resolve the changes developer merges them manually. l – Exclusive lines modified safe to merge. – Do you agree?

cappello@cs. ucsb. edu 2/28/2021 What is CVS for? l It maintains a source tree’s

cappello@cs. ucsb. edu 2/28/2021 What is CVS for? l It maintains a source tree’s change history. l It stamps each change with: – the time it was made – the changer’s user name. – [The purpose of the change. ]

cappello@cs. ucsb. edu 2/28/2021 What is CVS for? … l CVS helps answer questions

cappello@cs. ucsb. edu 2/28/2021 What is CVS for? … l CVS helps answer questions like: – Who made a given change? – When did they make it? – Why did they make it? – What other changes did they make at the same time?

2/28/2021 cappello@cs. ucsb. edu Essential CVS Commands Setting Your Repository A project’s source is

2/28/2021 cappello@cs. ucsb. edu Essential CVS Commands Setting Your Repository A project’s source is in a directory called a repository. l Before using cvs, set the cvs environment variable: CVSROOT l CSH: setenv CVSROOT /cs/faculty/cappello/cvs BASH: CVSROOT=/cs/faculty/cappello/cvs Export CVSROOT

cappello@cs. ucsb. edu 2/28/2021 Creating a Repository l To create a cvs repository in

cappello@cs. ucsb. edu 2/28/2021 Creating a Repository l To create a cvs repository in /cs/guest/cs/cvs: cvs –d /cs/guest/cx/cvs init – Absolute path name must be used. – The command is idempotent: • executing it with an existing cvs repository as a target, will do no harm.

2/28/2021 cappello@cs. ucsb. edu Starting a Project with CVS l If you have a

2/28/2021 cappello@cs. ucsb. edu Starting a Project with CVS l If you have a directory with your project: – cd to that directory; – Execute the command cvs import –m “Imported sources” <projectname> <vendorname> <releasename> – You will get a “tar”-like response. – After verifying that all went well, delete the original directory.

2/28/2021 cappello@cs. ucsb. edu Check Out a Working Directory l Check out the source

2/28/2021 cappello@cs. ucsb. edu Check Out a Working Directory l Check out the source tree called <projectname> from your repository – Execute cvs checkout <projectname> – This, in effect, is a “mkdir <projectname>” “ where <projectname> has • the contents of the <projectname> project • a CVS directory, used by cvs.

2/28/2021 cappello@cs. ucsb. edu Change Files of Working Directory l Edit, compile, & test

2/28/2021 cappello@cs. ucsb. edu Change Files of Working Directory l Edit, compile, & test files within the working directory in your usual way.

cappello@cs. ucsb. edu 2/28/2021 Merging Your Changes A developer works in his own directory.

cappello@cs. ucsb. edu 2/28/2021 Merging Your Changes A developer works in his own directory. l When your changes are tested: l – Synchronize your source with other members. cvs update – This merges changes made by others since your working directory was: • checked out • updated – cvs update lists changed files: U <filename> – Test the system with these new versions, if any.

cappello@cs. ucsb. edu 2/28/2021 Merging Your Changes … Committing Your Changes Execute the command

cappello@cs. ucsb. edu 2/28/2021 Merging Your Changes … Committing Your Changes Execute the command cvs commit <file 1> l CVS launches an editor, using: l – $CVSEDITOR, if that environment variable is set, – $EDITOR, if above is not set – vi, if neither of the above are set. l Committing w/o launching an editor cvs commit –m “message here” <file 1>

cappello@cs. ucsb. edu 2/28/2021 Examining Changes l A file’s log entries indicate what changes

cappello@cs. ucsb. edu 2/28/2021 Examining Changes l A file’s log entries indicate what changes have occurred: cvs log <filename> l This command’s output appears on the next slide.

2/28/2021 cappello@cs. ucsb. edu RCS file: /cs/faculty/cappello/cvs/cx/html/home. html, v Working file: home. html head:

2/28/2021 cappello@cs. ucsb. edu RCS file: /cs/faculty/cappello/cvs/cx/html/home. html, v Working file: home. html head: 1. 2 branch: locks: strict access list: symbolic names: release. Tag: 1. 1 vendor. Tag: 1. 1. 1 keyword substitution: kv total revisions: 3; selected revisions: 3 description: --------------revision 1. 2 date: 2001/02/13 12: 23: 08; author: cappello; state: Exp; lines: +2 -0 Test 2 of commit command --------------revision 1. 1 date: 2001/02/13 09: 41: 29; author: cappello; state: Exp; branches: 1. 1. 1; Initial revision --------------revision 1. 1 date: 2001/02/13 09: 41: 29; author: cappello; state: Exp; lines: +0 -0 Imported sources =======================================

cappello@cs. ucsb. edu 2/28/2021 CVS Log Command l cvs log also can select entries

cappello@cs. ucsb. edu 2/28/2021 CVS Log Command l cvs log also can select entries by: – date range – revision number

cappello@cs. ucsb. edu 2/28/2021 Examining changes … l To examine actual file changes cvs

cappello@cs. ucsb. edu 2/28/2021 Examining changes … l To examine actual file changes cvs diff –c –r 1. 1 –r 1. 2 home. html l The –c option requests the output be in human readable format. l Here is the output …

2/28/2021 cappello@cs. ucsb. edu Index: home. html ================================== RCS file: /cs/faculty/cappello/cvs/cx/html/home. html, v retrieving

2/28/2021 cappello@cs. ucsb. edu Index: home. html ================================== RCS file: /cs/faculty/cappello/cvs/cx/html/home. html, v retrieving revision 1. 1 retrieving revision 1. 2 diff -c -r 1. 1 -r 1. 2 *** home. html 2001/02/13 09: 41: 29 1. 1 --- home. html 2001/02/13 12: 23: 08 1. 2 ******** *** 1, 2 **** --- 1, 4 ---<html> + <head> + </head> </html>

2/28/2021 cappello@cs. ucsb. edu The cvs diff Command l Changed lines are prefixed with

2/28/2021 cappello@cs. ucsb. edu The cvs diff Command l Changed lines are prefixed with l Inserted lines are prefixed with l Deleted lines are prefixed with ! + -

cappello@cs. ucsb. edu 2/28/2021 Adding Files l After creating a file, execute cvs add

cappello@cs. ucsb. edu 2/28/2021 Adding Files l After creating a file, execute cvs add <filename> l Example cvs add control. html l Output cvs add: scheduling file `control. html’ for addition cvs add: use ‘cvs commit’ to add this file permanently

2/28/2021 l cappello@cs. ucsb. edu Execute cvs update l Output A control. html l

2/28/2021 l cappello@cs. ucsb. edu Execute cvs update l Output A control. html l Execute the commit (enter message) cvs commit control. html l Output RCS file: /cs/faculty/cappello/cvs/cx/html/control. html, v done Checking in control. html /cs/faculty/cappello/cvs/cx/html/control. html, v control. html Initial revision: 1. 1 done

cappello@cs. ucsb. edu 2/28/2021 Removing Files l Delete the file; l Execute cvs rm

cappello@cs. ucsb. edu 2/28/2021 Removing Files l Delete the file; l Execute cvs rm <filename> l The next cvs commit removes the file from the project.

cappello@cs. ucsb. edu 2/28/2021 Good Log Entries l A Good log entry does not

cappello@cs. ucsb. edu 2/28/2021 Good Log Entries l A Good log entry does not describe the change. l It gives the rationale for the change.

cappello@cs. ucsb. edu 2/28/2021 Handling Conflicts l If a team member modified lines of

cappello@cs. ucsb. edu 2/28/2021 Handling Conflicts l If a team member modified lines of a file that you have changed, cvs update detects the conflict. C control. html a conflict was detected Launch the editor l CVS marks the conflicting text l <<<<< … conflicting text goes here ===== … conflicting text goes here >>>>> 1. 2

cappello@cs. ucsb. edu 2/28/2021 Cleaning Up l When done with a project (for now)

cappello@cs. ucsb. edu 2/28/2021 Cleaning Up l When done with a project (for now) cvs release -d <projectname> l This removes the working directory. l Modified files are noted (M), in case you forgot to commit them – You have a chance to abort the release.

cappello@cs. ucsb. edu 2/28/2021 Installing the j. CVS Client l Download: http: //www. trustice.

cappello@cs. ucsb. edu 2/28/2021 Installing the j. CVS Client l Download: http: //www. trustice. com/java/jcvs/ l Unzip l View README. html (in Docs) l Client is jcvsii. jar in Jar folder l CVS online manual http: //www. cvshome. org/docs/manual/cvs. html

2/28/2021 cappello@cs. ucsb. edu Main Window

2/28/2021 cappello@cs. ucsb. edu Main Window

2/28/2021 cappello@cs. ucsb. edu Project Window

2/28/2021 cappello@cs. ucsb. edu Project Window

2/28/2021 cappello@cs. ucsb. edu

2/28/2021 cappello@cs. ucsb. edu