Subversion and Tools
The main web page for Subversion is located
here.
Source code can be found
here.
Binaries:
Useful Tools:
- AnkhSVN, integrates SVN into Visual Studio 2005, under development but it is free.
- SCplugin, a Mac OS X Finder plugin, for integrating SVN into the Mac, under development but it is free.
- TortoiseSVN, a nice windows shell extension, and it is free.
- VisualSVN, integrates SVN into Visual Studio 2005, but it costs money.
- WinMerge, File (& Directory) comparision, difference, and merge tool
- Though it claims SVN support, it doesn't appear to be SVN aware, IE you still need to use SVN diff or TortoiseMerge to get differences between versions
- Free Tool, Works on Windows XP & Vista, supports 64-bit operating systems, works with Unicode files
Using Subversion
The
Subversion FAQ answers the most common questions users have about subversion.
Here is a
crash course on subversion by Garrett Rooney.
The
Subversion Book gives a good overview of how subversion works plus some concrete guidance on how to use the various commands to maintain files in the repository.
Getting Access
You will need to have Murray Anderegg give you access to the repository, which you can get by sending an email to
Shawn Brown or
JackSnoeyink.
Getting Started (for 1st time):
- Make sure you have been authorized (send email to Murray Anderegg and/or Jack Snoeyink)
- Make sure you have a valid CS department "username" and "password"
- Download and install the command line subversion and/or a GUI Shell (like TortoiseSVN) from the downloads page
- Create your own invidual "branch" from the main source code trunk
Note: replace <username> & <password> below with your own CS "user name" and "password" in the commands below
svn copy https://cvs.cs.unc.edu/svn/tmv/trunk https://cvs.cs.unc.edu/svn/tmv/branches/<username> -m "Creating Initial Branch" --username <username> --password <password>
- Create your own target directory for storing your branch on your computer
c:\
mkdir TMV_shawndb
cd c:\TMV_shawndb
- Create your own target directory for storing the main trunk on your computer
c:\
mkdir TMV_trunk
cd c:\TMV_trunk
- Checkout the source code for your new branch directory
c:\
cd c:\TMV_shawndb
svn co https://cvs.cs.unc.edu/svn/tmv/branches/<username> --username <username> --password <password>
Note: Assuming the branch gets created properly, SVN should then cache your username & password
so you don't have to continually use the username, password parameters for SVN commands moving forward
- Checkout the main source code into your new trunk directory
c:\
cd c:\TMV_trunk
svn co https://cvs.cs.unc.edu/svn/tmv/trunk --username <username> --password <password>
Note: Assuming the branch gets created properly, SVN should then cache your username & password
so you don't have to continually use the username, password parameters for SVN commands moving forward
- Start programming with the files in your new directory
Common Usage Scenarios:
The most common Subversion (SVN) operations are
- Editing existing files to make changes
- Done with your favorite editor
- Checking differences between your version (and the latest version of the code)
- SVN update - pick up other peoples recent code changes
- SVN diff - used to check differences between two versions of the same file
- SVN resolved (to resolve collisions between two versions of the same file)
- Notes:
- Be careful not to lose recent changes by not including them in your check-in
- Be careful to correctly deal with collisions between your modified code and some-one elses recent changes.
- Committing your changes (modified files, additions, deletions) to the repository
- SVN commit - make modifications permanent in source tree (updates, adds, deletes, etc.)
- Note: Be careful to always run "SVN update" before you "commit", to catch conflicts with other peoples recent check-ins.
- Adding new files (and directories)
- SVN add - add brand new files/directories to branch or trunk, remember to use "SVN commit", to add permanently
- Deleting files (and directories)
- SVN delete - delete files/directories from branch or trunk
- Reviewing Changes
- SVN log - gives a log of any and all changes to repository
- Note: useful for tracking down when you last merged into/out of the main trunk
- Merging changes from your branch workspace to/from the main trunk
- SVN merge - useful to merge code changes from the branch back into the trunk (or vice versa)
- For Example:
c:
cd c:\TMV_Trunk
svn merge -r250:266 https://cvs.cs.unc.edu/svn/tmv/branches/<username>
Note: This example assume your invidual branch was created (or last merged) from the trunk
at revision 250 and the latest revision change to your branch is 266
Note: This would merge the all the changes from your branch since revision 250 back into the main trunk.
You would then have to resolve all conflicts by hand, using "SVN resolve",
and then commit the changes using "SVN commit" to make the merge changes permanent.
- Creating a new copy of an entire source tree in the repository (for instance, into a branch)
- SVN copy - see example for "Getting Started" above
- SVN co - check out, copies source code from repository into specified directory
- Creating a new repository for the very first time
- SVNadmin create - creates brand new repository for 1st time
- Recovering Deleted files
- Step 1 - find the revision where the file(s) got deleted
- svn log -v > search.txt
- look thru search.txt for the revision where the file got deleted
- make note of the revision #, let's call it 101 for example
- Step 2 - subtract 1 from the revision in step 1
- We want the revision just before the file got deleted
- For example: 101-1 = 100
- Step 3 - restore the file from the SVN trunk
svn copy <trunk>/<directory>/<filename>@<revision> ./<new_filename>
-
- For Example:
- if the file was deleted in the main "trunk" = https://cvs.cs.unc.edu/svn/tmv/trunk
- from the "directory" = tools/common/inc/
- with "filename" = tmv_quadedge.h
- and i wanted to copy it as "new_filename" = tmv_quadege.old
- Last good "revision" = 100
svn copy https://cvs.cs.unc.edu/svn/tmv/trunk/tools/common/inc/tmv_quadedge.h@290 ./tmv_quadege.old
TMV Subversion Directory structure
The base repository resides at UNC and is located at
https://cvs.cs.unc.edu/svn/tmv .
I have created the following sub-directories off this repository
Code Share | Notes |
https://cvs.cs.unc.edu/svn/tmv/trunk/binaries | Place holder to store built executables & library files. (*1,2) |
https://cvs.cs.unc.edu/svn/tmv/trunk/data | Meant to hold useful data files (meshes, models, images, etc.) (*1) |
https://cvs.cs.unc.edu/svn/tmv/trunk/matlab | Meant to hold useful MatLab scripts and projects (*1) |
https://cvs.cs.unc.edu/svn/tmv/trunk/docs | Meant to hold documents that we want under subversion (*1) |
https://cvs.cs.unc.edu/svn/tmv/trunk/tools | Contains useful tools we have developed (*3) |
https://cvs.cs.unc.edu/svn/tmv/trunk/apis | Contains Library Source Code (SM_API, SL_API, SP_API, SV_API) (*3,4) |
https://cvs.cs.unc.edu/svn/tmv/trunk/apps | Contains Application Source Code (tin2dem, RingFilt, etc.) (*3) |
Notes:
- 1: The binaries, data, doc, and matlab directories are empty directory structures for now. Useful documents and matlab scripts should be checked into their respective directories as they are developed. If we have the disk space, we should consider checking in known good binaries into the .\binaries directory and useful test data into the .\data directory.
- 2: The Visual Studio 2005 projects have been written to copy executables and libaries to the correct .\binaries sub-directory as a post build process.
- 3: All apps, libraries, and tools have a "project" sub-directory which is intended to help seperate project files (makefiles, VS2005 project files, etc.) from the rest of the important files (header files, source files, etc). They were co-mingled before.
- 4: I have also included the "STL" library source code which Martin originally used with all his libraries but is built into VS2005, and Mac so is redundant for this code base. We should remove this sub-directory once we are satisfied there is a good solution for Unix as well.
--
ShawnDB - 01 Jun 2008
to top