Using CVS to Manage Source RTL

Similar documents
CS2720 Practical Software Development

Portions adapted from A Visual Guide to Version Control. Introduction to CVS

CSCI 4152/6509 Natural Language Processing. Lab 1: FCS Computing Environment

Version Control Systems

CVS Application. William Jiang

Subversion FOUR. 4.1 What is Version Control? 4.2 What is Subversion? Types of Version Control SESSION

Task-Oriented Solutions to Over 175 Common Problems. Covers. Eclipse 3.0. Eclipse CookbookTM. Steve Holzner

Common Configuration Management Tasks: How to Do Them with Subversion

Apache Subversion Tutorial

Source Code Management

Handout 4: Version Control Reference

Version Control. 1 Version Control Systems. Ken Bloom. Linux User Group of Davis March 1, 2005

WinCvs Version 1.1. Users Guide. Don Harper

Tutorial #2. Verilog Simulation. Toolflow. % vcs RPP & Spring /16/05. T02 Verilog 1

About CVS. 1 Version Control - what is it? why is it useful?

Storing and Managing Code with CVS

A Short Introduction to Subversion

CVS How-to. 17th July 2003

CSE 374 Programming Concepts & Tools. Hal Perkins Winter 2012 Lecture 16 Version control and svn

Working with CVS in Eclipse

TDDC88 Lab 4 Software Configuration Management

Lab Exercise Git: A distributed version control system

Introduction to CVS. Sivan Toledo Tel-Aviv University

Introduction to Revision Control

Subversion Repository Layout

Software Development. Hack, hack, hack, hack, hack. Sorta works. Main.c. COMP s1

Effective Software Development and Version Control

Exercise 3: Adding a file to the master directory

How to version control like a pro: a roadmap to your reproducible & collaborative research

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

Using Subversion with LeMANS and MONACO

Manage quality processes with Bugzilla

Common CVS Command Summary

CS 320 Introduction to Software Engineering Spring February 06, 2017

2 Initialize a git repository on your machine, add a README file, commit and push

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

Hg Tutorial. For : COP Object oriented Programming (Using C++) Biswas Parajuli

Howto: CVS to Git Efficient Multi-Module CVS Migration

Department of Computer Science College of Engineering Boise State University

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Revision control. INF5750/ Lecture 2 (Part I)

And check out a copy of your group's source tree, where N is your one-digit group number and user is your rss username

Source control with Subversion A user perspective

Version Control: Gitting Started

Simulating Verilog RTL using Synopsys VCS

Submitting your Work using GIT

A Gentle Introduction to CMSC311 labs and CVS Or How I learned to use CVS in CMSC311. William Arbaugh September 2, 2004

Assumptions. GIT Commands. OS Commands

CSE 160: Introduction to Parallel Computation

Home Page. Title Page. Contents. Page 1 of 17. Version Control. Go Back. Ken Bloom. Full Screen. Linux User Group of Davis March 1, Close.

Version Control Systems (VCS)

Subversion. CS 490MT/5555, Fall 2015, Yongjie Zheng

Version control with RCS and CVS An introduction. Markus Bjartveit Krüger

Versioning. Jurriaan Hage homepage: Slides stolen from Eelco Dolstra.

CVS. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 21

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

2/9/2013 LAB OUTLINE INTRODUCTION TO VCS WHY VERSION CONTROL SYSTEM(VCS)? II SENG 371 SOFTWARE EVOLUTION VERSION CONTROL SYSTEMS

Computer Labs: Version Control with Subversion

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

CVS Workshop. How to manage your projects, source code, and associated files using the Concurrent Versioning System

1/20/13 Git tutorial. Git tutorial. Mike Nolta. file:///users/nolta/github/reveal.js/git.html?print-paper#/ 1/31

Managing Source Code With Subversion

Computer Labs: Version Control with Subversion

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

Software Tools Subversion

Revision control systems (RCS) and. Subversion

Table of Contents. 1 Context 2. 2 Problem statement 2. 3 Related work 2

Chapter 3. Revision Control

CS480. Compilers Eclipse, SVN, Makefile examples

Tutorial 2 GitHub Tutorial

6 Git & Modularization

CS108, Stanford Handout #37. Source Control CVS

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

CSE 331 Software Design & Implementation

LAB 0: LINUX COMMAND LINE AND SVN

Tools for software development:

Source Code Management wih git

Lecture 01 - Working with Linux Servers and Git

Using CVS 1 of 18. Using CVS. C oncurrent V ersions System - Jeremy Mates

Exercise 1: Basic Tools

Git Tutorial. Version: 0.2. Anders Nilsson April 1, 2014

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

ExpLab A Tool Set for Computational Experiments A Short Tutorial

CENG393 Computer Networks Labwork 1

Lecture Homepages as of FS 2017

git the SCM system Jan-Simon Möller training.linuxfoundation.org

Software Development I

CS 261 Recitation 1 Compiling C on UNIX

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger.

A CVS Repository for the RNB Group

CSCE UVM Hands-on Session-1 Pre-Work

CVS for Moodle Developers

Version Control with GIT

CESSDA Expert Seminar 13 & 14 September 2016 Prague, Czech Republic

MNXB Working with SVN. Florido Paganelli Lund University Tutorial 2b

February 2 nd Jean Parpaillon

Version Control. Kyungbaek Kim. Chonnam National University School of Electronics and Computer Engineering. Original slides from James Brucker

CVS for the developer or amateur

Apache Subversion (SVN)

Transcription:

Using CVS to Manage Source RTL 6.375 Tutorial 2 February 1, 2008 In this tutorial you will gain experience using the Concurrent Versions System (CVS) to manage your source RTL. You will be using CVS to submit your lab assignments, but more importantly CVS will make it much easier for groups of students to work on the same project simultaneously. CVS keeps track of the changes each user makes to the source RTL - this complete version history enables users to monitor what changes other users are making (each change includes log information), tag working versions of the design (so that users can always revert back to a working version), and resolve conflicts (when two users change the same bit of RTL at the same time). CVS stores all version information in a central repository. Users cannot access the repository directly, but must instead use a special set of CVS commands. Users begin by adding the initial version of their source RTL to the repository. Users can then checkout the most current version of the source RTL into a private working directory. Local changes to the working directory are not stored in the repository until the user does a commit. Each commit includes a log message so that other users can easily read what has changed. If multiple users are changing the source RTL at the same time, then the state of the repository might be different from when the user performed the original checkout. At any time, a user can do an update which brings the checked out working directory in sync with the global repository. Sometimes an update will identify a conflict. A conflict indicates that two users have made changes to the same bit of of RTL. Users must resolve conflicts by hand - essentially they must choose whose changes should be permanent. Figure 1 illustrates the relationship between the central repository and each user s personal working directory. In this tutorial we will create a test directory and a test file, add them to the repository, make some changes, commit these changes, and then emulate issues which arise when multiple users change the same file at the same time. Finally, we will learn how to use the ViewCVS program to browse the repository, read log messages, and track changes. You can find more information in the CVS user guide (cvs-user-guide.pdf) located in the course locker (/mit/6.375/doc). CVS Central Repository checkout, update add, commit checkout, update add, commit User A User B Figure 1: Basic CVS model. Users checkout versions from the central repository into private working directories.

6.375 Tutorial 2, Spring 2008 2 Getting started Before using the 6.375 toolflow you must add the course locker and run the course setup script with the following two commands. The course setup script will set the CVSROOT environment variable to /mit/6.375/cvsroot. The CVS commands use this environment variable to determine the location of the repository. % add 6.375 % source /mit/6.375/setup.csh Adding Directories and Files to CVS In this section we will look at how to add directories and files to the repository. Figure 2 shows the timeline of cvs commands involved in this section. All of your work will be in either your student CVS directory or your group s project CVS directory. For this tutorial we will be working in your student CVS directory. The very first step is to checkout this directory. All cvs commands are of the form cvs <command>. For example, assuming your user-name is cbatten the following commands will checkout your student CVS directory. % mkdir % cd % cvs checkout 2008s/students/cbatten % cd 2008s/students/cbatten The following commands first create a test directory and test file, and then add them to the cvs repository. % mkdir cvstest % cvs add cvstest % cd cvstest % echo Fred : 617-555-0123 > phone-list.txt % cvs add phone-list.txt User A CVS Repository cvs checkout files Create new dirs/files cvs add Figure 2: Timeline for checkout, add, and commit.

6.375 Tutorial 2, Spring 2008 3 It is very important to note that the cvs add command is not recursive. In other words you must add each file individually. We can use the find and xargs programs to emulate a recursive add. The following command will add the given <directory> and all files within that directory to the CVS repository. % find <directory> xargs cvs add Although the directory and file are added to the repository they are not actually in the repository until we commit them. Adding directories and files simply lets CVS know that we want the versioning system to track these files. We need to commit the directory and file before they are permanently in the repository. You can use the following command to check the current status of all files. /2008s/students/cbatten/cvstest % cvs status The status information should reflect that phone-list.txt has been locally added. We now need to commit our new files to the repository. We can do this with the following commands. /2008s/students/cbatten/cvstest % cvstest The command takes a list of files and directories as an argument. Unlike the cvs add command, the command is recursive, so committing a directory will effectively commit all files (and subdirectories) within the directory. If you do not specify any files or directories, then CVS will commit the current directory. After executing the command, you will be able to enter a log message using the simple Pico text editor. Use the cvs status command again to verify that the phone-list.txt file has now been committed into the repository. The status information lists a revision number. Every change is given a unique revision number. These numbers are assigned by the CVS system, and users should usually avoid working with revision numbers directly. Our final step is to delete our working directory. It is essential that we always keep in mind the difference between what is in the repository versus what is in the repository. As long as all our new files have been added, and all our changes have been committed then there is nothing wrong with deleting our working directory and doing a clean checkout. /2008s/students/cbatten /../.. % rm -rf 2008s

6.375 Tutorial 2, Spring 2008 4 Making and Committing Changes In this section we will checkout the cvstest directory, make a change, and then commit the change back into the repository. Figure 3 shows the timeline of cvs commands involved in this section. Our first step is to do a clean checkout of the cvstest directory. The cvs checkout command is recursive, so by checking out the cvstest directory we also checkout all files and subdirectories contained within cvstest. Now let s say Fred s phone number has changed. % cd 2008s/students/cbatten/cvstest % perl -i -pe s/fred.*/fred : 617-555-4567/ phone-list.txt You can use the cvs diff command to see how your current working directory differs from the repository. For example, if you use the cvs diff command in the cvstest directory, it will show that you have updated Fred s phone number. 2008s/students/cbatten/cvstest % cvs diff Index: phone-list.txt retrieving revision 1.1 1c1 < Fred : 617-555-0123 --- > Fred : 617-555-4567 And finally we commit our changes with an appropriate log message. % User A CVS Repository cvs checkout files Make changes to files Figure 3: Timeline for checkout, modify, and commit.

6.375 Tutorial 2, Spring 2008 5 We are done making our changes and everything has been committed so we can now delete our working directory. /2008s/students/cbatten/cvstest /../../.. % rm -rf 2008s Updating the In this section we will see how CVS can help multiple users work on the same project at the same time. Figure 4 shows the timeline of cvs commands involved in this section. To emulate two users we will checkout our cvstest directory into two different working directories. We begin with User A using the following commands to checkout the current cvstest directory. % mkdir usera % cd usera Let s say User B now checks out the current cvstest directory, adds a new file which contains email addresses, and adds information about a new person named Jane. % mkdir userb % cd userb % cd 2008s/students/cbatten/cvstest % echo Fred : fred@mit.edu > email-list.txt % echo Jane : 617-555-0021 >> phone-list.txt % echo Jane : jane@mit.edu >> email-list.txt % cat phone-list.txt Fred : 617-555-4567 Jane : 617-555-0021 % cat email-list.txt Fred : fred@mit.edu Jane : jane@mit.edu % cvs add email-list.txt % User B s final command commits both his changes to the phone-list.txt file as well as his newly added phone-list.txt file. Notice that at this point in time, User A s working directory is out-of-date (it does not contain the new email-list.txt file nor does it contain the updated phone-list.txt file). User A can use the cvs status command to realize that her working directory is out-of-date with respect to the central repository.

6.375 Tutorial 2, Spring 2008 6 /userb/2008s/students/cbatten/cvstest /../../../../usera/2008s/students/cbatten/cvstest % cvs status cvs status: Examining. =================================================================== File: phone-list.txt Status: Needs Patch revision: 1.2 Sun Feb 19 21:20:50 2008 Repository revision: 1.3.../2008s/students/cbatten/cvstest/phone-list.txt,v... Notice that the status of the phone-list.txt file is Needs Patch, and that the version of the file in the repository is later than the version in the working directory. User A can use the cvs update command to bring her working directory in sync with the central repository. /usera/2008s/students/cbatten/cvstest % ls CVS phone-list.txt % cat phone-list.txt Fred : 617-555-4567 % cvs update % ls CVS email-list.txt phone-list.txt % cat phone-list.txt Fred : 617-555-4567 Jane : 617-555-0021 % cat email-list.txt Fred : fred@mit.edu Jane : jane@mit.edu If User A uses cvs status again, she will see that her files are now up-to-date with respect to the central repository. As another example, User A can use the following commands to delete a file and then restore that file to the most current version in the repository. /usera/2008s/students/cbatten/cvstest % rm -rf phone-list.txt % cvs update If User A really wants to delete the file from the repository, then she can first delete the file from the working directory and then use the cvs remove command. These removals are not visible to other users until User A does a. /usera/2008s/students/cbatten/cvstest % rm -rf email-list.txt % cvs remove email-list.txt %

6.375 Tutorial 2, Spring 2008 7 CVS does not provide explicit commands for renaming or moving files, so users must instead use a combination of cvs remove and cvs add to preform these operations. If User B now does a cvs update, his copy of email-list.txt will also be removed. Let s finish up by deleting the working directories. /usera/2008s/students/cbatten/cvstest /../../../.. % rm -rf usera % rm -rf userb User A CVS Repository User B cvs checkout cvs update files files cvs checkout Make changes and add new files cvs add updates Remove file cvs remove Figure 4: Timeline for two users with no conflicts

6.375 Tutorial 2, Spring 2008 8 Resolving Conflicts In the previous section we examined what happens when two users simultaneously modify files in the same project. Notice however, that in the previous example, the two users never modified the same line of a file at the same time. In this section we will examine how to handle these conflicts. Figure 5 shows the timeline of cvs commands involved in this section. Let s begin with both User A and User B doing a standard checkout. % mkdir usera % cd usera % mkdir userb % cd userb Now let s assume that User A changes Fred s phone number as follows. % cd usera/2008s/students/cbatten/cvstest % perl -i -pe s/fred.*/fred : 617-555-3333/ phone-list.txt % Now assume that User B changes Fred s phone number to a different number. /usera/2008s/students/cbatten/cvstest /../../../../userb/2008s/students/cbatten/cvstest % perl -i -pe s/fred.*/fred : 617-555-5555/ phone-list.txt % : Examining. : Up-to-date check failed for phone-list.txt cvs [commit aborted]: correct above errors first! Notice that User B has received an error when trying to commit his changes. The CVS repository has realized that User B s change conflicts with User A s original change. So User B must do a cvs update first. /userb/2008s/students/cbatten/cvstest % cvs update cvs update: Updating. RCS file:.../2008s/students/cbatten/cvstest/phone-list.txt,v retrieving revision 1.3

6.375 Tutorial 2, Spring 2008 9 retrieving revision 1.4 Merging differences between 1.3 and 1.4 into phone-list.txt rcsmerge: warning: conflicts during merge cvs update: conflicts found in phone-list.txt C phone-list.txt The CVS messages during the update indicate that there is a conflict in phone-list.txt. A conflict simply means that there is a file in the current working directory which has lines which differ from what is in the repository. CVS tries to merge files so that only true conflicts are reported. In other words, if two people change different parts of the same file, then usually CVS will be able to merge the two versions without a conflict. In this case both User A and User B changed the exact same line, so CVS does not know which modification should take priority. CVS requires that users resolve conflicts by hand. After doing a cvs update, User B s copy of phone-list.txt will look like this. /userb/2008s/students/cbatten/cvstest % cat phone-list.txt <<<<<<< phone-list.txt Fred : 617-555-5555 ======= Fred : 617-555-3333 >>>>>>> 1.4 Jane : 617-555-0021 The content involved in the conflict is delimited by <<<<<<< and >>>>>>>. User B then needs to resolve the conflict by editing phone-list.txt. Let s assume that User B wants to override User A s earlier change. Edit phone-list.txt so that it looks like this. /userb/2008s/students/cbatten/cvstest % cat phone-list.txt Fred : 617-555-5555 Jane : 617-555-0021 Now if User B does a it will succeed and essentially User A s changes will have been overridden. User A can then do a cvs update to synchronize her working directory. A common rule of thumb is to always do an update (to catch conflicts) before doing a commit. Let s finish up by deleting the working directories. /userb/2008s/students/cbatten/cvstest /../../../.. % rm -rf usera % rm -rf userb

6.375 Tutorial 2, Spring 2008 10 User A CVS Repository User B cvs checkout Make changes files files cvs checkout Make changes Conflict! cvs update updates Resolve conflict by hand Figure 5: Timeline for two users with conflicts Using Tags In the previous sections we have learned how to use CVS to manage various versions of our source RTL. We have primarily focused on how to manipulate the most current version in the repository. Sometimes when we reach a milestone, we want to mark a version so that we can retrieve it at a later time even if we have already made (and committed) many other changes. We can do this with CVS tags. A tag is simply a symbolic name we give to a specific version of several files. The following commands checkout the cvstest directory, add two new files, and then tags everything. It is important to always do a cvs update and a before doing a cvs tag since the tag operation works on the most current version in the repository. If you have made changes in your local directory which are not yet committed then this could incorrectly tag the files. The -c option to the cvs tag command will cause CVS to abort if there are any locally modified files which are not committed yet. % cd 2008s/students/cbatten/cvstest % echo Fred : fred@mit.edu > email-list.txt % echo Jane : jane@mit.edu >> email-list.txt % echo Fred : 32-G736 > office-list.txt

6.375 Tutorial 2, Spring 2008 11 % echo Jane : 32-G738 >> office-list.txt % cvs add email-list.txt % cvs add office-list.txt % cvs update % % cvs tag -c example-tag The above commands tag all three files (phone-list.txt, email-list.txt, and office-list.txt) with the symbolic tag example-tag. We can now retrieve this version of the files at any time by using this tag. To see how this work s let s first commit some additional changes. /2008s/students/cbatten/cvstest % echo Sara : 617-555-0234 >> phone-list.txt % echo Sara : sara@mit.edu >> email-list.txt % echo Sara : 32-G736 >> office-list.txt % cvs update % Now let s delete the working directory and try checking out two different versions of the files. /2008s/students/cbatten/cvstest /../../.. % rm -rf 2008s % mkdir tagged-version % cd tagged-version % cvs checkout -r example-tag 2008s/students/cbatten/cvstest % mkdir current-version % cd current-version % cat tagged-version/2008s/students/cbatten/cvstest/phone-list.txt Fred : 617-555-3333 Jane : 617-555-0021 % cat current-version/2008s/students/cbatten/cvstest/phone-list.txt Fred : 617-555-3333 Jane : 617-555-0021 Sara : 617-555-0234 The checked out version in the tagged-version directory corresponds to the example-tag symbolic tag, while the version in the current-version directory corresponds to the most recent version in CVS. Tagging is particularly useful when you reach a working milestone. You can tag your project and then at any time you can go back and retrieve the working version as of that milestone. Let s finish up by deleting the working directories. % rm -rf

6.375 Tutorial 2, Spring 2008 12 Using ViewCVS to Browse the Repository The previous sections illustrated how to add, checkout, update, and commit files using CVS. It is often useful to browse the repository to see what changes other users have made. For example, assume one evening your RTL is working wonderfully. A group member makes some changes the next day and checks them in. Now the RTL starts failing some of your tests. You can browse the CVS repository to see what changes your partner made, and thus try and identify what is causing the failures. Although it is possible to browse the repository using cvs commands directly, it is much more convenient to use a graphical front-end to the repository. In 6.375, we will be using ViewCVS to browse the repository. The following command will launch ViewCVS and display the configuration dialog box (see Figure 6). % start-viewcvs & Click on the Open Browser button. After a few seconds a Mozilla browser should appear, and it should automatically point to http://localhost:6375/viewcvs. Browse the repository to the cvstest directory we have been working on in this tutorial. You should see the three files (phone-list.txt, email-list.txt, and office-list.txt). If you click on the drop-down Show files using tag: menu at the bottom of the page you can choose which tag to browse. If you click on one of the files you can see a complete version history of that file. The history lists the time, user, and log message for every version. Furthermore, you can actually view each version or compare the differences between versions. If more than one user on a specific machine is using ViewCVS at the same time, then the configuration dialog box may hang saying Starting server.... In this case you simply need to start ViewCVS on a different (currently unused) port using the -p command line option. Try several ports around 6375 until the configuration dialog box indicates you were able to setup a localhost server. % start-viewcvs -p 6376 & Figure 6: ViewCVS Configuration Dialog Box

6.375 Tutorial 2, Spring 2008 13 Review In this tutorial you have learned how to use CVS to manage your source RTL. You have learned how to add new files to the repository, checkout files from the repository, and commit local changes into the repository. You have also learned how to use ViewCVS to browse the CVS repository. The following table lists the cvs commands that you will use most frequently in this course. cvs checkout Checks out files from the repository into the working directory cvs add Adds new files to repository (must commit after adding) Commits files in working directory into the repository cvs update Brings working directory in synch with respect to repository cvs remove Removes file from CVS (must use rm first) cvs status Shows status of files in working dir compared to current version in repo cvs diff Shows how files in working dir differ from current version in repo cvs tag Adds a symbolic tag for current version (always use with -c)