cvs tutorial
TRANSCRIPT
BROADCOM PROPRIETARY & CONFIDENTIAL1
CVS (Concurrent Version System)Tutorial
11/17/08
BROADCOM PROPRIETARY & CONFIDENTIAL2
Contents Contents
• What is CVS for?• Accessing Unix
- basic knowledge of unix commands required• Getting started with CVS• Updating files, directories• Adding files, directories• Committing (checking-in the files)• Tagging and branching (advanced)• Web view of CVS ROOT• Some interactive examples
BROADCOM PROPRIETARY & CONFIDENTIAL3
What is CVS for? What is CVS for?
• CVS maintains a history of a source tree, in terms of a series of changes.
• It stamps each change with the time it was made and the user name of the person who made it.
• Usually, the person provides a bit of text describing why they made the change as well.
• Given that information, CVS can help developers 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?
BROADCOM PROPRIETARY & CONFIDENTIAL4
CVS Architecture CVS Architecture
Com
mitU
pdat
e Com
mitU
pdat
e
BROADCOM PROPRIETARY & CONFIDENTIAL5
Accessing UnixAccessing Unix
Accessing Unix machines remotely
BROADCOM PROPRIETARY & CONFIDENTIAL6
Accessing Unix (cont’d)Accessing Unix (cont’d)
Unix account password (i.e. not Windows NT password)
Unix farm selection
BROADCOM PROPRIETARY & CONFIDENTIAL7
Getting Started with CVSGetting Started with CVS• First set the variable CVSROOT
i. e.,
1. Add the followingsetenv CVSROOT /projects/rfams/systemgrp/cvsroot to your “.cshrc” file in your home directory. “emacs ~/.cshrc” command will open the file independent of you current directory. After saving the file;
2. Execute “source ~/.cshrc”
More info on “.cshrc”http://amath.colorado.edu/computing/unix/cshrc.html
BROADCOM PROPRIETARY & CONFIDENTIAL8
Checking out a working directory (example)
Checking out a working directory (example)
Command:$ cvs checkout labtools/test_temp
You will see the following lines after execution
cvs checkout: Updating test_temp U test_temp/test1.cgs U test_temp/test2.cgs
U test_temp/test3.cgs
This will update(download) the files in the folder test_temp.
BROADCOM PROPRIETARY & CONFIDENTIAL9
Inside a directoryInside a directoryTo see the details of the folder (for any folder)
Command:$ ls -l
You’ll see;
drwxr-xr-x 2 shan 512 Oct 31 11:04 CVS -rw-r--r– 1 nhut 89 Oct 31 10:42 test1.cgs -rw-r--r-- 1 shan 4432 Oct 31 10:45 test2.cgs -rwxr-xr-x 1 nhut 460 Oct 30 10:21 test3.cgs
File read/write settings
The user who made the latest modifications
Last modification date
Name of the files and folders.
Automatically generated. Hold details needed for CVS.
NEVER edit/modify the contents of this folder
BROADCOM PROPRIETARY & CONFIDENTIAL10
Making changes to a fileMaking changes to a file
Once CVS has created a working directory tree,
you can edit, compile and test the files it contains in the usual way -- they're just files.
BROADCOM PROPRIETARY & CONFIDENTIAL11
Updating a fileUpdating a fileFirst change your path to the target directory which includes the target file$ cd test_tempCommand:$ cvs update filename
Example:$ cvs update test1.cgs
You can always update multiple filesExamples1)cvs update test1.cgs2)cvs update test1.cgs test2.cgs3)cvs update *.cgs
It updates the file from the repository, but also tells you status of the file. Note: You don’t have to be in the same directory. The following command will update the same file; i.e., unix tools are applicable here.$ cvs update /projects/rfams/RadioTestData/esengul/labtools/test_temp/test1.cgs
BROADCOM PROPRIETARY & CONFIDENTIAL12
Updating a directoryUpdating a directoryUpdating the directory (e.g. test directory)
First change your path to the target directory$ cd test_temp Command:$ cvs update
It updates your working directory from the repository, but also tells you status of files.
BROADCOM PROPRIETARY & CONFIDENTIAL13
Important: cvs update relatedImportant: cvs update relatedAfter executing “cvs update” command, you may observe, e.g. after executing $ cvs update test1.cgs
1) cvs checkout: Updating test_temp U test_temp/test1.cgs This means you updated test1.cgs successfully. NO NEED TO WORRY
2) cvs checkout: Updating test_temp M test_temp/test1.cgs This means you merged test1.cgs successfully, i.e., you had some changes and/or CVS ROOT had some changes, all changes merged successfully (automatically). NO NEED TO WORRY
3) cvs checkout: Updating test_temp C test_temp/test1.cgs This means your had some changes to your local file and/or there were already changes checked-in by someone else. Automatic merging is NOT successful. HERE YOU NEED TO WORRY
BROADCOM PROPRIETARY & CONFIDENTIAL14
Resolving the conflictsResolving the conflictsWhen there is conflict, you need to open the file and see the conflicted areas; An example is here;
<<<<<<< test1.cgs if (! host_info) { fprintf (stderr, "%s: host not found: %s\n", progname, hostname); exit (1); }======= if (! host_info) { printf ("httpc: no host"); exit (1); }>>>>>>> 1.9
CVS ROOT has this portion
Your local copy has this portion
Either portion should be correct. Delete the incorrect portion!
BROADCOM PROPRIETARY & CONFIDENTIAL15
Resolving the conflictsResolving the conflicts
YOU HAVE TO RESOLVE ALL CONFLICTS
before checking-in
BROADCOM PROPRIETARY & CONFIDENTIAL16
Adding file(s) to CVS ROOTAdding file(s) to CVS ROOTOnce you generate a totally new fileFirst change your path to the target directory which includes the target file$ cd /labtools/test_tempCommand:$ cvs add test_nhut.cgs
You can always add multiple filesExamples1)cvs add test_nhut.cgs2)cvs add test_nhut.cgs test_shan.cgs
Here are files are added to the repository but until you do the “check-in” nothing will appear in the CVS ROOT.
BROADCOM PROPRIETARY & CONFIDENTIAL17
Adding directory CVS ROOTAdding directory CVS ROOT
Once you generate a totally new fileFirst change your path to the target directory which includes the target file$ cd /labtools/test_temp$ mkdir testDirCommand:$ cvs add testDir
Now the directory is added to the CVS ROOT (check-in is needed for files only, not needed for directories.
BROADCOM PROPRIETARY & CONFIDENTIAL18
Committing your changesImportant
Committing your changesImportant
BEFORE COMMITTING ANY CHANGES
1) DO A CVS UPDATE in the directory of interest.
2) RESOLVE ALL CONFLICTS ( conflicts are rare but you have to catch them, not to break any of the part of the project)
BROADCOM PROPRIETARY & CONFIDENTIAL19
Committing your changesassuming you did cvs update
and resolved conflicts and you are %100 sure of your changes
Committing your changesassuming you did cvs update
and resolved conflicts and you are %100 sure of your changes
Example$ cd /labtools/test_tempCommand:$ cvs commit –m “Updated PA register settings” test_nhut.cgs
Now the file is submitted to the CVS ROOT. When other group members do a “cvs update” in their directory, they will get the fresh copy that you generated most recently
BROADCOM PROPRIETARY & CONFIDENTIAL20
Log and log messagesLog and log messages
Example command$ cvs log test_nhut.cgs
• This will show history of the files, usernames who made the changes, etc.• This can be viewed from the web view also (will show in the upcoming slides
BROADCOM PROPRIETARY & CONFIDENTIAL21
Log and log messages (cont’d)Log and log messages (cont’d)lc-irva-872{esengul}2227: cvs log temp
RCS file: /projects/rfams/systemgrp/cvsroot/labtools/test_temp/temp,vWorking file: temphead: 1.4branch:locks: strictaccess list:symbolic names:keyword substitution: kvtotal revisions: 4; selected revisions: 4description:----------------------------revision 1.4date: 2008/07/24 17:36:00; author: aibrahim; state: Exp; lines: +2 -1
latest chanage----------------------------revision 1.3date: 2008/07/24 17:29:09; author: hjkim; state: Exp; lines: +1 -1
updated with best setting----------------------------revision 1.2date: 2008/07/24 17:21:31; author: hjkim; state: Exp; lines: +1 -1
change optimized register setting----------------------------revision 1.1date: 2008/07/24 17:20:05; author: hjkim; state: Exp;
testing cvs checkin
BROADCOM PROPRIETARY & CONFIDENTIAL22
Double checking your changes w.r.t ROOT Copy
Double checking your changes w.r.t ROOT Copy
Example command$ cvs diff test_nhut.cgs
• This is useful when you have a number of changes and helpful for the comment that you will have for the “check-in”
BROADCOM PROPRIETARY & CONFIDENTIAL23
Web view for CVSWeb view for CVShttp://projects.irv.broadcom.com/rfams/systemgrp/www/cgi-bin/cvsweb.cgi/
BROADCOM PROPRIETARY & CONFIDENTIAL24
Important: Usage of Editors (textpad etc)
Important: Usage of Editors (textpad etc)
• Best scenario: Everybody use the same text editor, e.g., textpad, at least with same tabbing settings.
• If one user has different tab settings and check-in the file, then the format of the file will be corrupted. The best usage is not changing tabbing format.
• HAVE the settings for your TEXTPAD as shown in the next slide.
BROADCOM PROPRIETARY & CONFIDENTIAL25
Important: Usage of Editors (textpad etc)
Important: Usage of Editors (textpad etc)
BROADCOM PROPRIETARY & CONFIDENTIAL26
CVS TaggingCVS Tagging
• Useful to make copies of whole project or subprojects. Later if needed, tagged version can be recovered, i.e., tagging-time versions of all files can be recovered simultaneously.
•We use tagging in the system group projects frequently, e.g. every month, to have snaphots of the whole project.
BROADCOM PROPRIETARY & CONFIDENTIAL27
Target directory structure for CGSTarget directory structure for CGS
Folder structure:/RadioTestData/<user_folder>/labtools/cgs/<project_name>/<ref_clock_freq>/<class_name>/<package_board_or_customer_name>
File name convention:<original_file_name>.<sub_folder_name>.cgs
Example/RadioTestData/shan/labtools/cgs/BCM4329B0/38_4MHZ/class1/WLBGA/BCM4329B0_002.001.017.0030.0000.CodePatches38_4MHz.cgs
BROADCOM PROPRIETARY & CONFIDENTIAL28
•Just google “cvs manual”• http://www.cs.utah.edu/dept/old/texinfo/cvs/cvs_toc.html
• http://www.nongnu.org/cvs/
• http://www.network-theory.co.uk/docs/cvsmanual/
• http://ximbiot.com/cvs/cvshome/docs/blandy.html
CVS ManualsCVS Manuals