1 / 28

Introduction to CVS: Concurrent Versions System

Introduction to CVS: Concurrent Versions System. What is CVS?. A version control system: A change history for a file set Open-source CVS as a: local version control system Internet client/server version control system. What is CVS? …. CVS uses unreserved check-outs:

leighe
Download Presentation

Introduction to CVS: Concurrent Versions System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to CVS:Concurrent Versions System Peter Cappello

  2. What is CVS? • A version control system: • A change history for a file set • Open-source • CVS as a: • local version control system • Internet client/server version control system

  3. What is CVS? … • 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. • CVS can't safely resolve the changes  developer merges them manually. • Exclusive lines modified  safe to merge. • Do you agree?

  4. What is CVS for? • It maintains a source tree’s change history. • It stamps each change with: • the time it was made • the changer’s user name. • [The purpose of the change.]

  5. What is CVS for? … • 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?

  6. Essential CVS CommandsSetting Your Repository • A project’s source is in a directory called a repository. • Before using cvs, set the cvs environment variable: CVSROOT CSH: setenv CVSROOT /cs/faculty/cappello/cvs BASH: CVSROOT=/cs/faculty/cappello/cvs\ Export CVSROOT

  7. Creating a Repository • 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.

  8. Starting a Project with CVS • 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.

  9. Check Out a Working Directory • 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.

  10. Change Files of Working Directory • Edit, compile, & test files within the working directory in your usual way.

  11. Merging Your Changes • A developer works in his own directory. • When your changes are tested: • 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.

  12. Merging Your Changes …Committing Your Changes • Execute the command cvs commit <file1> • CVS launches an editor, using: • $CVSEDITOR, if that environment variable is set, • $EDITOR, if above is not set • vi, if neither of the above are set. • Committing w/o launching an editor cvs commit –m “message here” <file1>

  13. Examining Changes • A file’s log entries indicate what changes have occurred: cvs log <filename> • This command’s output appears on the next slide.

  14. 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: releaseTag: 1.1.1.1 vendorTag: 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 Test2 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.1.1 date: 2001/02/13 09:41:29; author: cappello; state: Exp; lines: +0 -0 Imported sources =============================================================================

  15. CVS Log Command • cvs log also can select entries by: • date range • revision number

  16. Examining changes … • To examine actual file changes cvs diff –c –r 1.1 –r 1.2 home.html • The –c option requests the output be in human readable format. • Here is the output …

  17. Index: home.html =================================================================== RCS file: /cs/faculty/cappello/cvs/cx/html/home.html,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.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>

  18. The cvs diff Command • Changed lines are prefixed with ! • Inserted lines are prefixed with + • Deleted lines are prefixed with -

  19. Adding Files • After creating a file, execute cvs add <filename> • Example cvs add control.html • Output cvs add: scheduling file `control.html’ for addition cvs add: use ‘cvs commit’ to add this file permanently

  20. Execute cvs update • Output A control.html • Execute the commit (enter message) cvs commit control.html • 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

  21. Removing Files • Delete the file; • Execute cvs rm <filename> • The next cvs commit removes the file from the project.

  22. Good Log Entries • A Good log entry does not describe the change. • It gives the rationale for the change.

  23. Handling Conflicts • 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 • CVS marks the conflicting text <<<<<<<<< …  conflicting text goes here ========= …  conflicting text goes here >>>>>>>>> 1.2

  24. Cleaning Up • When done with a project (for now) cvs release -d <projectname> • This removes the working directory. • Modified files are noted (M), in case you forgot to commit them • You have a chance to abort the release.

  25. Installing the jCVS Client • Download: http://www.trustice.com/java/jcvs/ • Unzip • View README.html (in Docs) • Client is jcvsii.jar in Jar folder • CVS online manual http://www.cvshome.org/docs/manual/cvs.html

  26. Main Window

  27. Project Window

More Related