Subversion Quick Start Guide

How to start working on a new project with subversion.Create a new repository, import project files, do the first check out and the first commit.This tutorial is based on Ubuntu and you can change parameters to fit your needs.

1. First, create a repository for the project on the repository server:

Creates a repository waiting for an import. You don't work here, subversion uses the repository to store information about your projects

# svnadmin create /usr/local/subversion/my_project

 

2. IMPORT project to repository

a) Create project files: this is not the repository it is the WORKING COPY

# mkdir -p /home/allprojects/my_project/trunk
# mkdir -p /home/allprojects/my_project/branches
# mkdir -p /home/allprojects/my_project/tags

This structure is not required by subversion and they stand for:

- trunk: is for the main developement line

- branches: transvarsal developement line to correct bugs or experiment without bothering the main line

- tags: Used to tag distributed versions or to mark a project version to your convenience 

-- Add some files to the trunk directory (now copy here your first project files)

b) Import to repository to create the initial project in the svn repository with the syntax:svn import -m "Initial import"

cd /home/allprojects/
# svn import my_project file:///usr/local/subversion/my_project -m "Initial import"

This will add files to the repository creating the first project revision

 

3. Checkout

To work with your files you need to do a first check out a working copy of the repository, this is to "donwload" a copy to work on your machine (or folder in the same machine)

# svn checkout file:///usr/local/subversion/my_project

 

4. Change files owner BEFORE commit

--- In the repository

# chown -R www-data:www-data /usr/local/subversion/my_project

--- In project folder

# chown -R www-data:www-data  /home/allprojects/my_project

Check details with ls -lisa

 

5. Add, modify and commit

From YOUR project folder

Add everything

# svn add 

Add one file

# svn add file_name

Commit

# svn commit

 

6. Browsing files

http://127.0.0.1/svn/my_project/trunk

 

7. Commit problems command

Any problems?

 Resume post-commit:

# /usr/local/subversion/my_project/hooks/post-commit