Support / KnowledgeBase

 
Search the KnowledgeBase Search

Using Subversion

  • Applies to: Grid

  • Difficulty: Easy

  • Time needed: 10 minutes

  • Tools needed: SSH

 
  • Applies to: Grid
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: SSH

Overview

Subversion, often referred to as SVN, is a software versioning and a revision control system distributed under a free license. Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation.

Subversion is well-known in the open source community and is used on many open source projects, including Apache Software Foundation, Django, Ruby, Mono, SourceForge.net, and Tigris.org. Google Code also provides Subversion hosting for their open source projects.

Subversion is released under the Apache License, making it free software.

Requirements

This article has the following dependencies:

  • This article assumes that you have a basic understanding of svn usage. Please consult the authoritative site for subversion here for further assistance.
  • SSH access must be enabled for the user that will be using the repository. Please see our article: Connecting via SSH to your server.

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.

Instructions

Create your repository

NOTE:

If you want a user other than serveradmin to use your repository, please enable ssh access for that user first. Then create the repository using that account.

1. Log into your Grid using SSH. If you are setting up this repository as serveradmin then switch to your data directory and create a svn directory. Run each command separately:

cd data
mkdir svn && cd svn

If you are creating this repository as another user, you should remain in that user's home directory. The rest of this article assumes that the serveradmin user is being used. Please change any paths accordingly otherwise.

2. Inside your svn directory use the svnadmin command to create your repository:

NOTE:

  • You MUST use the filesystem type fsfs to ensure svn database compatibility.
  • Be sure to substitute repo_name with the name you would like to give your repository.
  • Replace 00000 with your site number.
svnadmin create --fs-type fsfs repo_name

3. Now you should create a layout for your various projects. The preferred method is the trunk/branch/tags style. Change to a directory you have created for your project and run the following commands. For this example we have created another directory in data called sites:

The example below will create two projects named website1 and website2. Please change accordingly. Run each command separately:

mkdir /home/00000/data/sites
cd /home/00000/data/sites/
mkdir website1
mkdir website1/trunk
mkdir website1/branches
mkdir website1/tags
mkdir website2
mkdir website2/trunk
mkdir website2/branches
mkdir website2/tags

4. Use the svn command to import the layouts you just created:

svn import /home/00000/data/sites file:///home/00000/data/svn/<repo-name> --message "Creating initial repo."

5. Your repository is now configured. You can always view its details using the following command:

svn list --verbose file:///home/00000/data/svn/<repo-name>

Connect to your repository

The Grid does not currently support http style links for subversion repositories. Instead, svn must be used through SSH.

The following example, run on your local computer, would list the contents of your repository on the Grid:

svn ls svn+ssh://example.com@example.com/home/00000/data/svn/<repo-name>

The following example, run on your local computer, would checkout your website1 trunk to a local directory named website 1:

TIP:

It is normal to have to enter your password twice when performing a checkout. This command opens two repository connections.

svn co svn+ssh://example.com@example.com/home/00000/data/svn/<repo-name>/website1/trunk website1

Further reading

 

Continue