CVS (Concurrent Version System) Tutorial
11/17/08
BROADCOM PROPRIETARY & CONFIDENTIAL
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 & CONFIDENTIAL
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 & CONFIDENTIAL 3
CVS Architecture
Commit
Commit
e adp U t
BROADCOM PROPRIETARY & CONFIDENTIAL
e adp U t
Accessing Unix
Accessing Unix machines remotely
BROADCOM PROPRIETARY & CONFIDENTIAL
Accessing Unix (contd)
Unix account password (i.e. not Windows NT password)
Unix farm selection
BROADCOM PROPRIETARY & CONFIDENTIAL
Getting Started with CVS
First set the variable CVSROOT i. e., 1. Add the following setenv 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 [Link]
BROADCOM PROPRIETARY & CONFIDENTIAL
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/[Link] U test_temp/[Link] U test_temp/[Link] This will update(download) the files in the folder test_temp.
BROADCOM PROPRIETARY & CONFIDENTIAL
Inside a directory
To see the details of the folder (for any folder) Command: $ ls -l Youll see; drwxr-xr-x 2 shan 512 -rw-r--r 1 nhut 89 -rw-r--r-- 1 shan 4432 -rwxr-xr-x 1 nhut 460 File read/write settings The user who made the latest modifications Oct 31 11:04 Oct 31 10:42 Oct 31 10:45 Oct 30 10:21 Last modification date CVS [Link] [Link] [Link] Name of the files and folders. Automatically generated. Hold details needed for CVS. NEVER edit/modify the contents of this folder
BROADCOM PROPRIETARY & CONFIDENTIAL
Making 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 & CONFIDENTIAL
10
Updating a file
First change your path to the target directory which includes the target file $ cd test_temp Command: $ cvs update filename Example: $ cvs update [Link] You can always update multiple files Examples 1)cvs update [Link] 2)cvs update [Link] [Link] 3)cvs update *.cgs It updates the file from the repository, but also tells you status of the file. Note: You dont 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/[Link]
BROADCOM PROPRIETARY & CONFIDENTIAL
11
Updating a directory
Updating 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 & CONFIDENTIAL
12
After executing cvs update command, you may observe, e.g. after executing $ cvs update [Link] 1)
Important: cvs update related
cvs checkout: Updating test_temp U test_temp/[Link] This means you updated [Link] successfully. NO NEED TO WORRY 2) cvs checkout: Updating test_temp M test_temp/[Link] This means you merged [Link] 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/[Link] 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 & CONFIDENTIAL
13
Resolving the conflicts
When there is conflict, you need to open the file and see the conflicted areas; An example is here; <<<<<<< [Link] 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 & CONFIDENTIAL 14
Resolving the conflicts
YOU HAVE TO RESOLVE ALL CONFLICTS before checking-in
BROADCOM PROPRIETARY & CONFIDENTIAL
15
Adding file(s) to CVS ROOT
Once you generate a totally new file First change your path to the target directory which includes the target file $ cd /labtools/test_temp Command: $ cvs add test_nhut.cgs You can always add multiple files Examples 1)cvs add test_nhut.cgs 2)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 & CONFIDENTIAL
16
Adding directory CVS ROOT
Once you generate a totally new file First change your path to the target directory which includes the target file $ cd /labtools/test_temp $ mkdir testDir Command: $ 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 & CONFIDENTIAL
17
Committing your changes Important
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 & CONFIDENTIAL
18
Committing your changes assuming you did cvs update and resolved conflicts and you are %100 sure of your changes
Example $ cd /labtools/test_temp Command: $ 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 & CONFIDENTIAL
19
Log 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 & CONFIDENTIAL
20
lc-irva-872{esengul}2227: cvs log temp
Log and log messages (contd)
RCS file: /projects/rfams/systemgrp/cvsroot/labtools/test_temp/temp,v Working file: temp head: 1.4 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 4; selected revisions: 4 description: ---------------------------revision 1.4 date: 2008/07/24 17:36:00; author: aibrahim; state: Exp; lines: +2 -1 latest chanage ---------------------------revision 1.3 date: 2008/07/24 17:29:09; author: hjkim; state: Exp; lines: +1 -1 updated with best setting ---------------------------revision 1.2 date: 2008/07/24 17:21:31; author: hjkim; state: Exp; lines: +1 -1 change optimized register setting ---------------------------revision 1.1 date: 2008/07/24 17:20:05; author: hjkim; state: Exp; testing cvs checkin
BROADCOM PROPRIETARY & CONFIDENTIAL 21
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 & CONFIDENTIAL
22
Web view for CVS
[Link]
BROADCOM PROPRIETARY & CONFIDENTIAL
23
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 & CONFIDENTIAL
24
Important: Usage of Editors (textpad etc)
BROADCOM PROPRIETARY & CONFIDENTIAL
25
CVS 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 & CONFIDENTIAL
26
Target directory structure for CGS
Folder structure: / RadioTestData/<user_folder>/labtools/cgs/<project_name>/ <ref_clock_freq>/<class_name>/<package_board_or_custo mer_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 & CONFIDENTIAL
27
CVS Manuals
Just google cvs
manual
[Link] [Link] [Link] [Link]
BROADCOM PROPRIETARY & CONFIDENTIAL
28