SVN

modified on 20 May 2010 at 02:25 - 1,750 views

From RoboWiki

Jump to: navigation, search

SVN, or Subversion, is an open-source version control system. This tool allows several developers to work on a single project file directory on a shared server. The goal is to centralize the source files and help in team collaboration. This tutorial is not for OSX or Linux as of yet.

Tools needed for SVN access in Windows:

  • An approved account for a given project – Ask team leaders for access
  • TortoiseSVN (http://tortoisesvn.tigris.org/) – A SVN client for windows explorer

Tools needed for SVN access in Linux:

The current subversion source control projects are found at the base address of:

Contents

[edit] Initially downloading a project's code (Checking-out)

Windows:

  1. Install tortoiseSVN (Download: http://tortoisesvn.net/downloads)
  2. Reboot the system (This is necessary for the above tool to hook with windows explorer)
  3. Create a new folder in your desired location to contain the project code
  4. Right click the new folder and select from the tortoiseSVN expansions the "SVN Checkout..." option
  5. For the "URL of repository" text field, type the http location of the target SVN
  6. Wait as tortoiseSVN downloads all files. This may be slow or quick depending on project size and internet connection
  7. You now have the latest project files, and you may "refresh" (download the latest files) by right-clicking your project folder and selecting "SVN Update"

Linux:

  1. Install the SVN client, either by compiling from source or using a package manager.
  2. From the Terminal, navigate to the folder you would like to download the project to.
  3. Type the command "svn checkout http://address.of.project desiredprojectname" where the desired project name is the name of the folder you'd like to download the code to. When left blank, it uses the name of the folder from the subversion directory.

[edit] Locking

When working with a large group it may be important to "lock" a file, in which other members are unable to edit that file and prevent a file-conflict when commiting back to the subversion.

Windows:

  1. To lock, right-click a target folder, select the turtoiseSVN expansion, and select "Get Lock..."
  2. To unlock, right-click a target folder, select the turtoiseSVN expansion, and select "Unlock..."

Linux:

  1. To lock, type the command "svn lock /path/to/file" where the path is the file or folder you'd like to lock
  2. To unlock, type the command "svn unlock /path/to/file" where the path is the file or folder you'd like to unlock

[edit] Updating the code with changes

Windows:

Linux:

  1. Navigate to the folder you'd like to update
  2. Type the command "svn update"
  3. For a single file, type "svn update filename"

[edit] Loading code back to the server (Checking-in)

Windows:

  1. Once you are done making your changes to a file or series of files, select your project directory
  2. Right click on said project file/folder and select SVN commit...
  3. Enter an appropriate message (which is a log of all commits) and select OK. This also automatically releases any locks you have on files

Linux:

  1. Navigate to the folder you'd like to commit to the repository
  2. Type the command "svn commit -m "comment"" , where the comment is a short description of the changes made

[edit] External Links