Presentation is loading. Please wait.

Presentation is loading. Please wait.

Version Control Using Subversion Tom Hilinski Natural Resource Ecology Laboratory Colorado State University October 2007

Similar presentations


Presentation on theme: "Version Control Using Subversion Tom Hilinski Natural Resource Ecology Laboratory Colorado State University October 2007"— Presentation transcript:

1 Version Control Using Subversion Tom Hilinski Natural Resource Ecology Laboratory Colorado State University October 2007 http://www.nrel.colostate.edu/projects/irc/ “Software”, “Knowledge Base”, “Software Development Notes”

2 Version Control - Contents What is it? Why use it? Repository structure About Subversion Repository URLs Creating a repository Work cycle Deleting repository Exporting Using Tags Using Branches Other Topics Subversion Tools Additional Information

3 What is Version Control?

4 Why Use Version Control? Concurrent editing with conflict resolution Synchronize files on different computers Versions for different audiences Version with different algorithms History and justification Backup Source control

5 Repository Structure Make a directory to hold your repositories. Repository subdirectories: trunk = main set of files branches = new development (temporary) or different algorithms (permanent) tags = labeled trunk points-in-time /data/ojima/svn-repos/IRC_Century5/ trunk/ Ecosystem/ Numerical/... branches/... tags/...

6 About Subversion Commands: svn, svnadmin, svnlook Open-source project - Apache/BSD-style license Successor to CVS (“a better CVS”) Safe “atomic” commits Standalone or networked client/server Tracks file contents; directories; copy, rename, move actions; metadata Binary file version control Multiplatform

7 Repository URLs Directory: /data/ojima/svn-repos/respos-name URL from NREL: file:///data/ojima/svn-repos/respos-name/ URL from outside CSU: svn+ssh://user-name@rubel.nrel.colostate.edu /data/ojima/svn-repos/respos-name/

8 Creating a Repository Example 1. Create a directory to hold repositories: mkdir ~/dev/svn-repos cd ~/dev/svn-repos 2. Create the repository: mkdir myproject svnadmin create myproject svn mkdir URL/trunk URL/branches URL/tags 3. View the directory tree: svnlook tree myproject 4. Add ( svn add ) or import ( svn import ) files.

9 Work Cycle with Subversion First step - checkout files: svn co Modify files What's changed? svn status, svn diff Add file/directory: svn add Delete file/directory: svn delete Rename/Move: svn move Merge changes Add other's changes: svn update Conflicts resolved: svn resolve Add your changes: svn commit Next day first thing: svn update Continue modifying files.

10 Deleting Repository & CO'd Files Delete a repository: From the OS rm -Rf ~/dev/svn-repos/myproject/* Delete all checked-out files: From the OS rm -R ~/dev/myproject/*

11 Exporting From Repository Exporting copies directories and files from a Subversion repository. Exported files are not under version control. Exported directories do not have hidden Subversion subdirectory “.svn” Useful for sending a “clean” package of files, or archiving elsewhere. svn export file://repos-path/trunk/ ~/myproject/archive/07-10-11/

12 Using Tags Tags are a read-only copy of trunk or a branch. Act as a label for release, bug-fix, algorithmic change, etc. Using svn copy, stores only pointers to trunk. Create: svn copy file://repos-path/trunk file://repos-path/tags/release-07-10-11 Export from a tag: svn export file://repos-path/tags/release-07-10-11 ~/release/07-10-11/

13 Using Branches Branches begin as a copy of trunk at a point in time. Useful for: Make modifications w/out affecting trunk. Add algorithms/documents for a special version. Begin a new release with its own bug fixes. Disadvantages: Increased complexity – risk of spaghetti-azation. Merging bug-fix branch requires more effort. Using svn copy, stores only pointers to trunk.

14 Other Topics Editing conflict resolution Reverting to a previous version Merging branches Sharing files between repositories Incorporating third-party files Repository backup Configuring Subversion Comparison to CVS, RCS, SCS, etc. Repository mirrors

15 Subversion Tools svn, svnadmin, svnlook Cygwin for Microsoft Windows: cygwin.com TortoiseSVN integrates with Microsoft Windows RapidSVN client is multiplatform Ksvn for Linux/KDE Subclipse plug-in for Eclipse Framework

16 Additional Information Subversion web site: subversion.tigris.org The Subversion Book: svnbook.red-bean.com TortoiseSVN: tortoisesvn.tigris.org IRC and Century5: Subversion Quick Guide www.nrel.colostate.edu/projects/irc/ public/Documents/ KnowledgeBase/SubversionQuickGuide.htm


Download ppt "Version Control Using Subversion Tom Hilinski Natural Resource Ecology Laboratory Colorado State University October 2007"

Similar presentations


Ads by Google