Why CVS is Your Friend - PowerPoint PPT Presentation

About This Presentation
Title:

Why CVS is Your Friend

Description:

... a branch back into the main development tree: cvs update -j branch_tag_name ... Fogel & Bar, published by Coriolis cvsbook.red-bean.com (Book/Partially Online) ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 32
Provided by: worke5
Category:
Tags: cvs | beantree | friend

less

Transcript and Presenter's Notes

Title: Why CVS is Your Friend


1
Why CVS is Your Friend
  • Amandeep Jawa
  • deep_at_worker-bee.com
  • Worker Bee Software

2
Why You Should Care
  • CVS can make your job easier
  • CVS saves YOUR time and effort
  • CVS will save your butt (trust me)
  • CVS is mandatory -)

3
Agenda
  • Version Control Overview
  • CVS Concepts
  • Basic CVS Work Flow
  • Most Common Commands
  • Additional Commands
  • Commands you might not use
  • Additional CVS Features
  • Tips Warnings
  • References
  • Summary

4
What is Version Control Good For?
  • Maintaining project/file history - so you dont
    have to worry about it.
  • Managing collaboration on files and projects - so
    multiple developers can work on the same set of
    files
  • Managing releases - so you know what files are in
    what version.

5
CVS Concepts
  • CVS becomes easy to use once you understand the
    concepts behind it
  • The Repository The Magic Place That Holds All
    Versions of Everything
  • Your Working Copy(ies) The place(s) where you
    get to do whatever you want.
  • The CVS program manages moving files between the
    two.

6
Basic CVS Work Flow
  • Get a working copy
  • Make changes in your copy
  • Test them locally
  • Integrate them with any changes made to the
    Repository
  • Commit them back to the Repository
  • Repeat these steps until a release is ready
  • Tag the release
  • Start making changes again for next release

7
CVS Command Structure (Commandline)
  • cvs global options command command options
    files
  • There a few global options - most useful are
  • -n dont actually DO the next command - just
    show what you would do. Really useful for update
  • -H display help on the given command
  • -q or -Q quiet or VERY quiet
  • Each command has its own set of options
  • By default most commands operate recursively - be
    careful

8
Common Commands Overview
  • Checkout Makes your working copy
  • Update Updates your working copy with the latest
    files from the Repository
  • Commit Commits the latest changes from your
    working copy to the Repository
  • Log Look at the history of a file(s)
  • Diff Compare two versions of a file
  • Tag Label a version (also used for branching)

Remember that most commands have MANY options
9
Checkout
  • Makes your working copy from the Repository
  • cvs checkout ltproject_namegt
  • Run this command from the parent directory of
    your working copy
  • Useful command options include
  • -r to get a specific revision or symbolic tag
  • E.g cvs checkout -r 1.3 my_project
  • -D to get a specific date
  • E.g cvs checkout -D 17 May 2001 my_project
  • E.g cvs checkout -D 2 weeks ago my_project

10
Update
  • Updates your working copy with the latest files
    from the Repository
  • cvs update ltfile/directory namegt
  • Merges changes from the Repository into your code
    unless you tell it not to
  • Reports the state of the files in your working
    copy
  • Useful global options include -n -q

11
Update (continued)
  • Useful command options include
  • -A Remove all sticky tags so that the latest
    version can be retrieved
  • -d Creates updates any new project directories
    created
  • -j Can be used to retrieve a specific file/folder
    version (will set a sticky tag)
  • -p Prunes empty directories
  • We recommend always using -dp

12
Update (continued 2)
  • Update reports the state of each file with a line
    for every file such as X somefile.java where X
    may be
  • A File added but not committed
  • C Conflict detected - working copy must be
    hand-merged
  • M Modified - you have modified your working copy
    it has not been committed to the Repository yet
  • R File removed but not committed
  • U File was updated from Repository
  • ? File is not in Repository is unknown to CVS

13
Update (continued 3)
  • If a conflict occurs, there is nothing to panic
    about - conflicts are usually easy to fix.
  • A conflict area will be marked in the working
    copy like this
  • ltltltltltltlt file name
  • ltthe uncommitted changes in your working copygt
  • ltchanges committed to the Repository since you
    last updatedgt
  • gtgtgtgtgtgtgt 1.7
  • To resolve the conflict, simply edit the file
    replace the conflict area with whatever SHOULD be
    there. You may need to discuss the area with the
    other developer.

14
Commit
  • Commits the latest changes from your working copy
    to the Repository
  • cvs commit ltfilenamegt
  • After committing, you will be prompted for a log
    comment.
  • You must enter a log comment when you commit
  • Useful command options include
  • -m to enter a log comment without being prompted

15
Log
  • Look at the history of a file(s)
  • cvs log ltfile or directory namegt

16
Diff
  • Compare two versions of a file
  • If one file is specified, it is compared against
    the repository, a tagged version, a revision, or
    a dated version
  • If 2 files are specified, they are compared. The
    files can be specified by revision number, tag,
    or date

17
Diff (continued)
  • A difference area will be marked in the working
    copy like this
  • lt ltthe lines from the 1st file (or the
    repositorygt
  • ---
  • gt ltthe lines from the 2nd file (or the current
    versiongt
  • Various useful options exist including -c which
    shows lines of context around each area of
    difference

18
Tag
  • Label a version or create a branch
  • cvs tag lttag_namegt
  • Tag names must start with a letter can only
    contain numbers, letters, -, _
  • Useful command options
  • -d removes the tag
  • -F moves the tag to the given revision or current
    version
  • -b is used to create a branch tag - which is how
    a branch is started.

19
Additional Commands Overview
  • Add Adds a new file or folder to the Repository
    (be careful with binary files)
  • Remove removes a file from the Repository
  • Branch Allows you to make changes to an old
    version of the project later integrate this
    into the latest version
  • Status Gives you detailed information about a
    file

20
Add
  • Adds a new file or folder to the Repository
  • cvs add ltfile or foldergt
  • Adding a folder is simple - but note it does not
    add the contents
  • Adding files is a 2 step process
  • If the file is a binary file, make sure you add
    it with the -kb option

21
Remove
  • Removes a file or folder from the Repository
  • cvs remove ltfile or foldergt
  • After removing a folder you should prune it
  • When removing a file you must remove it from the
    file system first
  • Removing files is a 2 step process

22
Branch
  • Allows you to make changes to an old version of
    the code later integrate this into the latest
    version

23
Branch (Continued)
  • To create a branch
  • Make a new directory you want to use for the
    branch
  • Cd to the new directorys parent directory
  • Get the version you want to branch from
  • cvs checkout -d ltnew_directorygt -r ltoriginal_taggt
    ltproject_namegt
  • Cd into the new project directory
  • Make a branch
  • cvs tag -b ltbranch_tag_namegt
  • Prepare the branch for editing
  • cvs update -r ltbranch_tag_namegt

24
Branch (Continued 2)
  • To merge a branch back into the main development
    tree
  • cvs update -j ltbranch_tag_namegt
  • If you have any conflicts, deal with them as
    usual.

25
Status
  • Gives you detailed information about a file
  • cvs status ltfile namegt
  • Tells you about any sticky tags that are set

26
Commands you might not use
  • Import For putting an entire set of files into
    the Repository - used to start a project
  • Export Create a working copy with NO CVS
    information - good for src dumps
  • Help Prints out command summaries
  • Admin Allows you to modify various things such
    as log messages the files keyword substitution
    mode

27
Additional CVS Features
  • cvsrc lets you set default command options for
    yourself
  • cvswrappers set default options for specific
    file types
  • cvsignore sets file types to just ignore
  • loginfo, taginfo, etc set requirements for
    logging tagging format etc.
  • Keyword expansion
  • Watches, Emails, Locking etc.
  • Annotation

28
Tips Warnings
  • Turn off keyword expansion for binary files
  • Sticky Tags are set whenever you get a file by
    revision, tag or date
  • Checkout from top
  • Add commit
  • -dp for latest directories

29
More Tips Warnings
  • Date can be specified in English like yesterday
    or 2 weeks ago
  • Recursive

30
References
  • Version Management with CVS by Per Cederqvist,
    www.cvshome.org
  • CVS Pocket Reference Gregor Purdy, published by
    OReilly
  • Open Source Development with CVS Fogel Bar,
    published by Coriolis cvsbook.red-bean.com
    (Book/Partially Online)

31
Summary
  • CVS makes your job easier by maintaining your
    files history making it possible to have
    multiple developers working on the same set of
    files without bloodshed
  • CVS moves files between the Repository your
    working copy
  • Help Prints out command summaries
Write a Comment
User Comments (0)
About PowerShow.com