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 te SVN Central Repository upda checkout User A Working Directory mit add com checkout update add com mit User B Working Directory 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 be in either your student SVN directory or your group s project SVN directory For this tutorial we will be working in your student SVN directory The very first step 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 Working Directory SVN Repository svn checkout files Create new dirs files svn add svn commit 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 cd TUTROOT yunsup mkdir svntest cd svntest mkdir trunk branches tags cd trunk echo Fred 510 555 0123 phone list txt cd TUTROOT 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 cd TUTROOT 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 cd TUTROOT yunsup svn commit svntest The svn commit command takes a list of files and directories as an argument The svn commit 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 svn commit 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
View Full Document