Welcome to the Lab Subversion (SVN) Resource Page

Subversion (svn) is used in the lab to maintain current and historical versions of project files such as source code, web pages, and documentation. It is not only indispensable for personal use, but also for larger collaborative projects. It also provides a "time machine" view of a project, easily allowing one to go back in time to earlier versions of developed code.

Useful online resources:

Laboratory SVN Resources

The laboratory's secure subversion server is hosted on the laboratory machine ccmsvn, but you do not need to log onto this machine to access the databases.

The server can be accessed outside of the lab at the URL http://www.ccm.ece.vt.edu:3015/svn. For example:

Inside of the lab, it can be accessed at http://ccmsvn/svn. For example:

Common SVN Commands

svn checkout http://ccmsvn/svn/CCMLab_Project_Name
OR
svn co http://ccmsvn/svn/CCMLab_Project_Name
Check out code from a remote web repository. This command will check out a working copy of the subversion source code into a new subdirectory called subversion. Note, this is just an example. Substitute your project name for my_project
svn checkout –username myuser –password …… On the majority of the commands you can set the –username parameter and the –pasword to help automate things, instead of being prompted for them. Once you create a local working copy, your client should really cache that information, however.
svn update Run this in your project directory to get the latest changes from the source control server.
svn update -r 123 Run this in your project directory to update to the specific revision 123
svn stat
OR
svn st
Run this in your project directory, gives you the status of all the files and directories. If it returns nothing, then you are in sync. M before a file means modified, and ? means the file is not in source control.
svn revert This will revert the changes that you have made to your working copy.
svn diff filename.cpp This will show the differences between filename.cpp and the working copy. This is most useful after running an svn stat and seeing that the file is modified. You can then run this command to see what the differences are.
svn revert filename.cpp This will revert all changes you have made to filename.cpp back to the copy in the repository.
svn revert -R * This will revert all changes you have made to the entire project back to the repository version.
svn -v list This will list the files in source control for the current workspace directory
svn -v list _http://ccmsvn/svn/CCMLab_Project_Name This will list all files in source control at the particular subversion repository URL. Fairly useful if you want to see what the structure is before doing a checkout.
svn info Gives you info about the current working copy, including the URL of the repository it points to, and the last changed date/author.
svn commit -m “Adding new function” filename.cpp Commit the changes in filename.cpp, and give it a useful message. Using the messages is highly important down the road when you want to figure out what a particular change did. Make sure you use them.
svn commit -m “Adding lots of new functions” Use this function without the filename to commit all changes to all files. This is useful when you have a set of changes spanning multiple files. (common)
svn log
svn log filename.cpp
svn log –limit 5 http://ccmsvn/svn/CCMLab_Project_Name
Use this function to take a look at the log messages. The first one is for the entire working copy, the last one shows just the last 5 log messages on a web repository.
svn add newfile.cpp Add a file or directory to version control. Note that you still have to commit to actually send the file to the source control server. You also can only use this command from within a working copy directory, meaning if you haven’t used source control on that directory you will need to import it first.
svn move filename.cpp newfilename.cpp Allows you to rename or move files within source control. You can either use filenames in your local repository, or you can even pass in two URL locations to have it be moved/renamed on the server side. This command is the same as doing a copy and then a delete.
svn copy my_source my_new_source Allows you to copy a file or directory, either with local files, or on the repository using the URL syntax.
svn delete filename.cpp Deletes the filename from source control. Note that the filename will still exist in older revisions, but will be deleted from the current revision.
svn blame filename.cpp This is one of my favorite commands in subversion. This lists out the file, giving the revision and person who changed every single line in the file. Very useful
svn import -m “Importing the files” my_source
http://svn.theserver.net/svnroot/mysource

Import Code into Subversion

This command imports the directory my_source and all files contained within into the subversion server. The URL can be several levels deep or more.

Note: once you import a source code directory, you should remove the directory and then checkout the directory so that you can have a proper working copy. Oh, and back up your files before you delete them. I don’t want any nasty emails about how you lost source code.

SVN Administration (for project leaders)

Topic attachments
I Attachment Action Size Date Who Comment
pdfpdf svn-book.pdf manage 1235.7 K 12 Feb 2007 - 22:22 UnknownUser Subversion Full Documnetation
pdfpdf svn-ref.pdf manage 42.4 K 12 Feb 2007 - 22:21 UnknownUser Subversion Reference (2 pages)
Topic revision: r6 - 08 Jul 2009 - 18:28:50 - PeterAthanas
Main.SubversionGuide moved from TWiki.SubversionGuide on 10 Jan 2007 - 23:11 by WikiAdministrator - put it back
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback