Using SVN to Manage Source RTL



Similar documents
Using SVN to Manage Source RTL

SVN Starter s Guide Compiled by Pearl Guterman June 2005

Introduction to Subversion

Version Control. Luka Milovanov

Version Control Using Subversion. Version Control Using Subversion 1 / 27

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

using version control in system administration

CISC 275: Introduction to Software Engineering. Lab 5: Introduction to Revision Control with. Charlie Greenbacker University of Delaware Fall 2011

Version Control with Subversion

CSE 374 Programming Concepts & Tools. Laura Campbell (Thanks to Hal Perkins) Winter 2014 Lecture 16 Version control and svn

Version Control with Subversion and Xcode

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

Subversion workflow guide

Version Control Script

Introducing Xcode Source Control

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

Using Subversion in Computer Science

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Unix the Bare Minimum

Subversion Integration for Visual Studio

Managing Software Projects Like a Boss with Subversion and Trac

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

Version Control with Subversion

CSE 70: Software Development Pipeline Build Process, XML, Repositories

Version Control with Git. Kate Hedstrom ARSC, UAF

EAE-MS SCCAPI based Version Control System

Extending Remote Desktop for Large Installations. Distributed Package Installs

Revision control systems (RCS) and

Introduction to Source Control Management in OO 10

BlueJ Teamwork Tutorial

CS108, Stanford Handout #33. CVS in Eclipse

Setting up a local working copy with SVN, MAMP and rsync. Agentic

Source Code Management/Version Control

ECE 4750 Computer Architecture, Fall 2015 Tutorial 2: Git Distributed Version Control System

Version Control with Git. Dylan Nugent

Source Code Management for Continuous Integration and Deployment. Version 1.0 DO NOT DISTRIBUTE

Version Control with. Ben Morgan

Thirty Useful Unix Commands

MATLAB & Git Versioning: The Very Basics

CSE 70: Software Development Pipeline Version Control with Subversion, Continuous Integration with Bamboo, Issue Tracking with Jira

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Subversion. Nadir SOUALEM. Linux Users subversion client svn or higher. Windows users subversion client Tortoise 1.6.

BestSync Tutorial. Synchronize with a FTP Server. This tutorial demonstrates how to setup a task to synchronize with a folder in FTP server.

CS 2112 Lab: Version Control

Software Delivery Integration and Source Code Management. for Suppliers

Lab 1: Introduction to C, ASCII ART and the Linux Command Line Environment

Version Control! Scenarios, Working with Git!

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

An Introduction to Mercurial Version Control Software

PxPlus Version Control System Using TortoiseSVN. Jane Raymond

EVault for Data Protection Manager. Course 361 Protecting Linux and UNIX with EVault

Source Control Systems

Command Line Crash Course For Unix

Version Control Systems

Uploads from client PC's to mercury are not enabled for security reasons.

DAVE Usage with SVN. Presentation and Tutorial v 2.0. May, 2014

Version Control with Mercurial and SSH

Version control tracks multiple versions. Configuration Management. Version Control. V Software Engineering Lecture 12, Spring 2008

Running your first Linux Program

Version Control Using Subversion. 12 May 2013 OSU CSE 1

Managing Source Code With Subversion

Hadoop Basics with InfoSphere BigInsights

Mercurial. Why version control (Single users)

Xcode Source Management Guide. (Legacy)

Annoyances with our current source control Can it get more comfortable? Git Appendix. Git vs Subversion. Andrey Kotlarski 13.XII.

Work. MATLAB Source Control Using Git

Manual. CollabNet Subversion Connector to HP Quality Center. Version 1.2

Answers to Even-numbered Exercises

Introduction to Version Control with Git

Adobe Marketing Cloud Using FTP and sftp with the Adobe Marketing Cloud

Version Uncontrolled! : How to Manage Your Version Control

[PRAKTISCHE ASPEKTE DER INFORMATIK WS 13/14]

XenClient Enterprise Synchronizer Migration

Unix Sampler. PEOPLE whoami id who

FEEG Applied Programming 3 - Version Control and Git II

Software development. Outline. Outline. Version control. Version control. Several users work on a same project. Collaborative software development

USEFUL UNIX COMMANDS

QUICK START BASIC LINUX AND G++ COMMANDS. Prepared By: Pn. Azura Bt Ishak

CSCB07 Software Design Version Control

Using the Radmind Command Line Tools to. Maintain Multiple Mac OS X Machines

Version control with Subversion

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11

Using Git for Project Management with µvision

Using an Edline Gradebook. EGP Teacher Guide

INF 111 / CSE 121. Homework 4: Subversion Due Tuesday, July 14, 2009

OneDrive for Business User Guide

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

Linux Overview. Local facilities. Linux commands. The vi (gvim) editor

Transcription:

Using SVN to Manage Source RTL CS250 Tutorial 1 (Version 083010a) August 30, 2010 Yunsup Lee In this tutorial you will gain experience using the Subversion (SVN) to manage your source RTL and code. You will be using SVN to submit your lab assignments, but more importantly SVN will make it much easier for groups of students to work on the same project simultaneously. SVN 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). SVN stores all version information in a central repository. Users cannot access the repository directly, but must instead use a special set of SVN 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. You can find more information in the SVN book (svn-book.pdf) located at the following website: http://svnbook.red-bean.com. SVN Central Repository checkout, update add, commit checkout, update add, commit User A User B Figure 1: Basic SVN model. Users checkout versions from the central repository into private working directories.

CS250 Tutorial 1 (Version 083010a), Fall 2010 2 Getting started You can follow along through the tutorial yourself by typing in the commands marked with a % symbol at the shell prompt. To cut and paste commands from this tutorial into your bash shell (and make sure bash ignores the % character) just use an alias to undefine the % character like this: % alias %="" Before using the CS250 toolflow you must run the course setup script with the following command. The course setup script will set the SVNREPO to https://isvn.eecs.berkeley.edu/cs250. The SVN commands use this environment variable to determine the location of the repository. % source ~cs250/tools/cs250.bashrc Adding Directories and Files to SVN In this section we will look at how to add directories and files to the repository. Figure 2 shows the timeline of SVN commands involved in this section. All of your work will bein either your student SVN directory or your group s project SVN directory. For this tutorial we will beworkingin your student SVN directory. Thevery firststep is to checkout this directory. All SVN commands are of the form svn <command>. For example, assuming your username is yunsup the following commands will checkout your student SVN directory. % mkdir tut1 % cd tut1 % TUTROOT=$PWD % svn checkout $SVNREPO/yunsup Error validating server certificate for https://isvn.eecs.berkeley.edu:443 : - The certificate is not issued by a trusted authority. Use the fingerprint to validate the certificate manually! Certificate information: User A SVN Repository svn checkout files Create new dirs/files svn add Figure 2: Timeline for checkout, add, and commit.

CS250 Tutorial 1 (Version 083010a), Fall 2010 3 - Hostname: isvn.eecs.berkeley.edu - Valid: from Thu, 15 Jan 2009 19:53:47 GMT until Sat, 15 Jan 2011 19:53:47 GMT - Issuer: Instructional Support Group, University of California Berkeley,... - Fingerprint: 41:10:d6:7a:ad:4b:a5:20:02:09:f6:65:ad:4c:f5:37:f3:ef:03:30 (R)eject, accept (t)emporarily or accept (p)ermanently? p Whenever you access the SVN repository for the firsttime, it will complain about the certificate. This is because the certificate on the server is not issued by a trusted authority. Go ahead and accept the certificate permanently. The following commands first create a test directory and a typical SVN directory structure, test file, and then add them to the SVN repository. The trunk directory is supposed to be the main development line for the project. The branches directory is supposed to be a place for branches. The tags directory is used for creating tags. /yunsup % mkdir svntest % cd svntest % mkdir trunk branches tags % cd trunk % echo "Fred : 510-555-0123" > phone-list.txt /yunsup % svn add svntest Although the directory and file are added to the repository they are not actually in the repository until you commit them. Adding directories and files simply lets SVN know that you want the versioning system to track these files. You 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. /yunsup/svntest % svn status The status information should reflect that phone-list.txt has been locally added. Now you will commit your new files to the repository. /yunsup svntest The command takes a list of files and directories as an argument. 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 SVN will commit the current directory. After executing the command, you will be able to enter a log message using your default text editor. You can change the default text editor by setting the environment variable SVN EDITOR. You can add the environment variable to your default shell script so that the variable is set automatically in the future whenever you login. % export SVN_EDITOR=vim

CS250 Tutorial 1 (Version 083010a), Fall 2010 4 Use the svn 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 SVN system, and users should usually avoid working with revision numbers directly. Our final step is to delete your working directory. It is essential that you always keep in mind the difference between what is in the repository versus what is in the repository. As long as all your new files have been added, and all your changes have been committed then there is nothing wrong with deleting your working directory and doing a clean checkout. % rm -rf yunsup Making and Committing Changes In this section you will checkout the svntest directory, make a change, and then commit the change back into the repository. Figure 3 shows the timeline of SVN commands involved in this section. Our first step is to do a clean checkout of the svntest directory. The svn checkout command is recursive, so by checking out the svntest directory you also checkout all files and subdirectories contained within svntest. User A SVN Repository svn checkout files Make changes to files Figure 3: Timeline for checkout, modify, and commit. Now say Fred s phone number has changed. /svntest % perl -i -pe s/fred.*/fred : 510-555-4567/ phone-list.txt You can use the svn diff command to see how your current working directory differs from the repository. For example, if you use the svn diff command in the svntest directory, it will show that you have updated Fred s phone number. The revision number X is the number stored on the server.

CS250 Tutorial 1 (Version 083010a), Fall 2010 5 /svntest % svn diff Index: phone-list.txt =================================================================== --- phone-list.txt (revision X) +++ phone-list.txt (working copy) @@ -1 +1 @@ -Fred : 510-555-0123 +Fred : 510-555-4567 And finally you commit your changes with an appropriate log message. You are done making your changes and everything has been committed so you can now delete your working directory. % rm -rf svntest Updating the In this section you will see how SVN can help multiple users work on the same project at the same time. Figure 4 shows the timeline of SVN commands involved in this section. To emulate two users you will checkout your svntest directory into two different working directories. You begin with User A using the following commands to checkout the current svntest directory. % mkdir usera % cd usera Say User B now checks out the current svntest directory, adds a new file which contains email addresses, and adds information about a new person named Jane. % mkdir userb % cd userb % cd svntest % echo "Fred : fred@eecs.berkeley.edu" > email-list.txt % echo "Jane : 510-555-0021" >> phone-list.txt % echo "Jane : jane@eecs.berkeley.edu" >> email-list.txt % cat phone-list.txt Fred : 510-555-4567 Jane : 510-555-0021 % cat email-list.txt Fred : fred@eecs.berkeley.edu

CS250 Tutorial 1 (Version 083010a), Fall 2010 6 User A SVN Repository User B svn checkout svn update files files svn checkout Make changes and add new files svn add updates Remove file svn remove Figure 4: Timeline for two users with no conflicts Jane : jane@eecs.berkeley.edu % svn 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 svn status --show-updates command to realize that her working directory is out-of-date with respect to the central repository. If the User A doesn t use the --show-updates option then it prints locally modified items without accessing the central repository. /usera/svntest % svn status --show-updates * X phone-list.txt * email-list.txt * X. Status against revision: Y Notice that the phone-list.txt file and the email-list.txt file have an asterisk mark which means a newer version exists on the server. X is the local revision number, while Y is the revision number stored on the server. User A can use the svn update command to bring her working directory in sync with the central repository.

CS250 Tutorial 1 (Version 083010a), Fall 2010 7 /usera/svntest % ls -a.svn phone-list.txt % cat phone-list.txt Fred : 510-555-4567 % svn update % ls -a.svn email-list.txt phone-list.txt % cat phone-list.txt Fred : 510-555-4567 Jane : 510-555-0021 % cat email-list.txt Fred : fred@eecs.berkeley.edu Jane : jane@eecs.berkeley.edu If User A uses svn status --show-updates 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/svntest % rm -f phone-list.txt % svn 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 svn remove command. These removals are not visible to other users until User A does a. /usera/svntest % rm -f email-list.txt % svn remove email-list.txt If User A wants to rename or move files, then she can use the svn move command. /usera/svntest % svn move phone-list.txt telephone-list.txt If User B now does a svn update, his copy of email-list.txt will removed and the file phone-list.txt will be renamed as telephone-list.txt. Finish up by deleting the working directories. % rm -rf usera % rm -rf userb Resolving Conflicts In the previous section you 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

CS250 Tutorial 1 (Version 083010a), Fall 2010 8 User A SVN Repository User B svn checkout Make changes files files svn checkout Make changes Conflict! svn update updates Resolve conflict by hand Figure 5: Timeline for two users with conflicts same line of a file at the same time. In this section you will examine how to handle these conflicts. Figure 5 shows the timeline of SVN commands involved in this section. Begin with both User A and User B doing a standard checkout. % mkdir usera % cd usera % mkdir userb % cd userb Now assume that User A changes Fred s phone number as follows. /usera/svntest % perl -i -pe s/fred.*/fred : 510-555-3333/ telephone-list.txt Now assume that User B changes Fred s phone number to a different number. /userb/svntest

CS250 Tutorial 1 (Version 083010a), Fall 2010 9 % perl -i -pe s/fred.*/fred : 510-555-5555/ telephone-list.txt Sending telephone-list.txt Transmitting file data.svn: Commit failed (details follow): svn: Out of date: yunsup/svntest/trunk/telephone-list.txt in transaction X-1 svn: Your commit message was left in a temporary file: svn: tut1/userb/svntest/svn-commit.tmp Notice that User B has received an error when trying to commit his changes. The SVN repository has realized that User B s change conflicts with User A s original change. So User B must do a svn update first. /userb/svntest % svn update Conflict discovered in telephone-list.txt. Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: e The SVN messages during the update indicate that there is a conflict in telephone-list.txt. A conflict simplymeans that thereis afileinthecurrentworkingdirectory whichhaslines whichdiffer from what is in the repository. SVN 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 SVN 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 SVN does not know which modification should take priority. SVN requires that users resolve conflicts by hand. You can pick a way to resolve a conflict by selecting an option when SVN asks. Assume you picked the edit option. The text editor will show the following. 1 <<<<<<<.mine 2 Fred : 510-555-5555 3 ======= 4 Fred : 510-555-3333 5 >>>>>>>.rx 6 Jane : 510-555-0021 The content involved in the conflict is delimited by <<<<<<< and >>>>>>>. Assume that User B wants to override User A s earlier change. Leave the text from the mine part, and delete everything else to make the following. 1 Fred : 510-555-5555 2 Jane : 510-555-0021 After saving the file SVN will prompt you again, but with a new option called resolved. Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: r Now User B s commit has succeeded and essentially User A s changes will have been overridden. User A can then do a svn update to synchronize her working directory. A common rule of thumb is to always do an update (to catch conflicts) before doing a commit. Finish up by deleting the working directories.

CS250 Tutorial 1 (Version 083010a), Fall 2010 10 % rm -rf usera % rm -rf userb Using Tags In the previous sections you have learned how to use SVN to manage various versions of your source RTL. You have primarily focused on how to manipulate the most current version in the repository. Sometimes when you reach a milestone, you want to mark a version so that you can retrieve it at a later time even if you have already made (and committed) many other changes. You can do this with SVN tags. A tag is simply a symbolic name you give to a specific version of several files. The following commands checkout the svntest directory, add two new files, and then tags everything. It is important to always do a svn update and a before doing a svn copy 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. % cd svntest % echo "Fred : fred@eecs.berkeley.edu" > email-list.txt % echo "Jane : jane@eecs.berkeley.edu" >> email-list.txt % echo "Fred : SODA 802" > office-list.txt % echo "Jane : SODA 903" >> office-list.txt % svn add email-list.txt % svn add office-list.txt % svn update % svn copy $SVNREPO/yunsup/svntest/trunk \ $SVNREPO/yunsup/svntest/tags/checkpoint The above commands tag all three files(telephone-list.txt, email-list.txt, and office-list.txt) with the symbolic tag checkpoint. You can now retrieve this version of the files at any time by using this tag. To see how this works first commit some additional changes. /svntest % echo "Sara : 510-555-0234" >> telephone-list.txt % echo "Sara : sara@eecs.berkeley.edu" >> email-list.txt % echo "Sara : SODA 810" >> office-list.txt % svn update Now delete the working directory and try checking out two different versions of the files. % rm -rf svntest % mkdir tagged-version % cd tagged-version

CS250 Tutorial 1 (Version 083010a), Fall 2010 11 % svn checkout $SVNREPO/yunsup/svntest/tags/checkpoint svntest % mkdir current-version % cd current-version % cat tagged-version/svntest/email-list.txt Fred : fred@eecs.berkeley.edu Jane : jane@eecs.berkeley.edu % cat current-version/svntest/email-list.txt Fred : fred@eecs.berkeley.edu Jane : jane@eecs.berkeley.edu Sara : sara@eecs.berkeley.edu The checked out version in the tagged-version directory corresponds to the checkpoint symbolic tag, while the version in the current-version directory corresponds to the most recent version in SVN. 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. Finish up by deleting the working directories. % cd.. % rm -rf tut1 Browse the Repository using your Web Browser Type in https://isvn.eecs.berkeley.edu/cs250/<username> into your browser. Then use your credentials to login. Now you can browse your repository online. You will have the same certificate problem, though just allow the browser to accept the certificate permanently. Figure 6: Browsing the Repository using your Web Browser

CS250 Tutorial 1 (Version 083010a), Fall 2010 12 Review In this tutorial you have learned how to use SVN 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. The following table lists the SVN commands that you will use most frequently in this course. svn checkout (co) Checks out files from the repository into the working directory svn add Adds new files to repository (must commit after adding) (ci) Commits files in working directory into the repository svn update (up) Brings working directory in sync with respect to repository svn remove (rm) Removes file from SVN svn move (mv) Rename files from SVN svn status (st) Shows status of files in working dir compared to current version in repo svn diff Shows how files in working dir differ from current version in repo svn copy (cp) Adds a symbolic tag for current version Acknowledgements Many people have contributed to versions of this tutorial over the years. The tutorial was originally developed for 6.375 Complex Digital Systems course at Massachusetts Institute of Technology by Christopher Batten. Contributors include: Krste Asanović, John Lazzaro, Yunsup Lee, and John Wawrzynek. Versions of this tutorial have been used in the following courses: CS250 VLSI Systems Design (2009-2010) - University of California at Berkeley 6.375 Complex Digital Systems (2005-2009) - Massachusetts Institute of Technology CSE291 Manycore System Design (2009) - University of California at San Diego