Version Control using Subversion (SVN)
290 likes | 457 Vues
Version Control using Subversion (SVN). February 29, 2008. David Goldschmidt, Ph.D. Computer Science The College of Saint Rose. also Track Changes in Microsoft Word. Version Control.
Version Control using Subversion (SVN)
E N D
Presentation Transcript
Version Control usingSubversion (SVN) February 29, 2008 David Goldschmidt, Ph.D. Computer Science The College of Saint Rose
also Track Changesin Microsoft Word... Version Control • Version control refers to the managementof multiple versions (a.k.a. revisions)of project-related documents,source code, etc. • Synonyms include: • Revision control • Source control • Source code management
Version Control System • A version control system is crucial to engineering and software development projects • Maintains a centralized repositoryof digital documents • Facilitates organized team-basedcollaboration • Provides revision history forboth individual documentsand groups of documents • Often supports multiple branches of development disadvantage: extra workflow
Version Control Systems • Numerous version control systems are available • Commercial (ranging from $100-$4000+ per user): • ClearCase • Microsoft Visual SourceSafe • Open-source – free: • RCS (Revision Control System) • SCCS (Source Code Control System) • CVS (Concurrent Versions System) • Subversion http://en.wikipedia.org/wiki/Comparison_of_revision_control_software
Architecture of a Version Control System • Centralized repositoryserves multiple clients http://www.zefhemel.com/archives/2005/03/24/isdw-day-4-file-exchange
Subversion • Developed in 2000 and 2001 (by CollabNet, Inc.)to replace CVS and its shortcomings • Subversion is free • Subversion is open-source • Subversion operates across a network • Subversion handles any types of files,documents, or directories • Subversion requires administrativesupport http://svn.collab.net/ http://svnbook.red-bean.com/
Subversion’s Storage Repository • Subversion provides a centralized storage repository • Storage repository acts as a fileserver • Clients connect, thenread from or write to files • Clients can also view logsof changes made to filesor directories • All changes are logged,storing date, time, user responsible, user-specified notes
Problems with Sharing Files • Overwriting changes
Problems with Sharing Files • How can we solve the overwriting changes problem? • Allow a client to lock a file,ensuring only that client canmake changes to the file • Clients can still read the file,but only one client has accessto write the file back to the repository • Key disadvantage: idle developer time spent waiting for write-access
The Copy-Modify-Merge Approach • Subversion uses the copy-modify-merge approach • No locking of files
The Copy-Modify-Merge Approach • Subversion will merge the changes together • Conflicts may arise....
Resolving Conflicts • How are conflicts resolved? • A conflict does not occur ifchanges exist in separate partsof the file • A conflictdoes occur ifchanges overlap • Subversion shows bothversions and allows Harry todecide how to perform the merge
Using Subversion • On its own, Subversion is command-line driven • UNIX: • MS-DOS: • Numerous GUIs have been built on top of SVN • TortoiseSVN • VisualSVN • XCode (Mac OS X) $ svn checkout http://xyz.com:3690/rep ... C:\> svn checkout http://xyz.com:3690/rep ... http://tortoisesvn.net/
TortoiseSVN • TortoiseSVN is • Open-source (free) • Integrated directlyinto Windows Explorer • Usable with any development environment http://tortoisesvn.net/
TortoiseSVN • From Windows Explorer, use TortoiseSVNby right-clicking... • Right-click withina folder or on anindividual file • A context-sensitivemenu with applicableoptions appears
TortoiseSVN: Checking Files Out • Read files from the repository by usingthe checkout command • Connect to the repository using: or include the port number: • Typically checkout the entire trunk to ensureproper compilation • Once checked out, you may modify files,delete files, create new files, etc. svn://srv55z3 svn://srv55z3:3690
TortoiseSVN: Checking Files Out • Read files from the repository by usingthe checkout command • Specify the URLof the repository • Select the localcheckout directory • Specify a revision,if applicable • Also view history logs
TortoiseSVN: Viewing a File’s Status • Windows Explorer shows the status of your files • A checkmark withina green circle indicatesthe file has not beenaltered since checkedout of the repository • An exclamation pointwithin a red circleindicates the file or folder has been modified
TortoiseSVN: Reviewing & Committing Changes • After appropriate changes, deletions, and additions have been made, you may commit your changes • SVN recordsyour changesand associates themwith a new revision number • Update the repositorywith all of your changesby performing a commitfrom the top-level folder
TortoiseSVN: Reviewing Changes • View a diff of the files to be committed
TortoiseSVN: Committing Changes • Describe your changesfor the revision log • Commit fromthe top-level folder • Every change that you commit goes down in history....
TortoiseSVN: Committing Changes • A commit operation is atomic • The new revision number isshown in the resulting dialog box
TortoiseSVN: Importing a New Set of Files • Right-click andselect Importto add a newset of files tothe repository
TortoiseSVN: Importing a New Set of Files • Specify the repository URL, including the name of the subdirectory to create in the repository
TortoiseSVN: Typical Workflows • Update your working copy (i.e. your local repository): • svn update • Change your working copy: • svn add • svn delete • svn copy • svn move • svn mkdir
TortoiseSVN: Typical Workflows • Review your changes: • svn status • svn diff • svn revert (undo) • Resolve conflicts by merging: • svn update • svn resolved • Commit your changes: • svn commit
Additional Recommendations • Usage recommendations: • Avoid storing binary files or JARs • Binary files use a lot of repository space • Avoid storing IDE-specific files • e.g. do not store JDeveloper workspace or project files • Commit changes at meaningful checkpoints • Frequently enough for others toshare in development • Infrequently enough so asnot to create too many revisions
Thank You! • Thank you for yourinterest and attention • Please feel free to e-mail me (goldschd@strose.edu) with additional questions