SVN: Introduction

Revision as of 01:13, 24 November 2010 by Upazixorys (talk | contribs)

 

MPG

Uniform Server 5.0-Nano.
Subversion (SVN)

Installing Subversion on 5.0-Nano

This series explains how to install Subversion on Uniform Server 5.0-Nano. The goal is to produce a fully portable version running from a USB memory stick.

To achieve this goal Subversion is installed first as a fixed installation and tweaked for portability.

Subversion overview

Subversion is a file version control system it tracks all changes made to a file that is under version control.

Subversion can be installed and run locally this standalone configuration does not require a server and is ideal for a personal file version control system allowing you to tract all changes made to a file.

This series looks at running subversion on a server, with the advantage of Internet or Intranet access. Hence you can access the version control system remotely and have access to all changes made to files under version control. This can be for personal use or open to any number of users.

Top

Version control system

Technical details aside a file control system is nothing more than a single folder containing all files we wish to track. These files may be organised in folders, in this situation the whole lot is copied into the above single folder thus preserving the structure.

The single folder is referred to, as a repository there are no restrictions to where it is located.

Files in a repository cannot be edited directly they need to be copied using a client such as Windows Explorer to another folder. In this working folder files are edited and returned to the same location within the repository using the client.

Ok I have just described how to use the Windows file system with terminology appropriate to a file control system.

  • repository - A single file located anywhere. Contains folders and file to be tracked
  • working folder - Contains working copies of folders and files extracted from a repository these can be freely edited.
  • client - A program that extracts from a repository working copies of folders and files. After editing the client returns edited folders and files back to the repository. The repository updates the version number and perform any other house keeping.

Top

Repository

Our single folder (repository) clearly is not a functional repository. Prior to use this folder needs to be converted (created) into a true repository. SVN for Windows has a specical command line tool (svnadmin.exe) that performs this task, covered later.

Whats important are the support folders and files created, each repository created contains the following:

  • Folders: conf, dav, db, hooks and locks
  • Files: README.txt and format

Never edit or delete the above folders or files. They tag and track all changes in a repository.

Note:

When a repository is viewed using either an SVN client or browser the above folders and files are invisible. However when viewed using Windows Explorer are visible.

Top

Structure

Once a folder has been converted into a repository you can start using it straight away. Use an SVN client to add your project (folders and files). However it is recommended you first create the following three folders:

  Trunk: Is the main branch of development. This is where your next major release lives. It has all the newest features and code.
  Branches: Are used to try out new features without disturbing the main line of development. Once stable are merged back into the trunk. Or every time you release a major version a branch created. This allows you to do bug fixes and make a new release without having to release the newest unfinished or untested main version.
  Tags: Every time you release a version such as final release, release candidate or betas make a tag for it. Its a point-in-time copy of the code and should never be editted. Must remain fixed and unchaged allowing you to go back to a known point in time.

With the above structure in place add all your new material to the trunk.

I cover a quick method for setting up the above structure latter. Just want to get the ideas inplace first.

Top

Apache and Repositories

Subversion and Apache tightly bind together making configuration relative easy. Again technical details aside and assume subversion has been installed. Before configuring Apache decide how you are going to organise your repositories. You can have any number of these distributed across hard drives alternatively group them all in a single folder. Apache configuration is slightly different depending on what type of organisation you choose.

Top

General

A Location directive is the basic building bock it informs Apache where you keep your Subversion repository or repositories.

<pre>

<Location /repos_name>

 DAV svn
 SVNPath /absolute/path/to/repository

</Location> </pre>

  • repos_name Name you type into a browser e.g <nowiki>http://localhost</nowiki>/repos_name
  • DAV svn Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request.
  • SVNPath Absolute path to the repository folder. (Generally repos_name and folder name are the same.)

Note: The location block can have additional Apache directives.

Top

Distributed

In a distributed repository configuration each repository requires it own location bock. Example below shows two repositories on different drives.

<pre>

<Location /image_controller>

 DAV svn
 SVNPath C:/design/image_controller

</Location> </pre>

  • image_controller Name you type into a browser e.g <nowiki>http://localhost</nowiki>/image_controller
  • DAV svn Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request.
  • SVNPath Absolute path to the repository folder C:/design/image_controller
<pre>

<Location /unitray_menu>

 DAV svn
 SVNPath E:/project2/menus/unitray_menu

</Location> </pre>

  • unitray_menu Name you type into a browser e.g <nowiki>http://localhost</nowiki>/unitray_menu
  • DAV svn Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request.
  • SVNPath Absolute path to the repository folder E:/project2/menus/unitray_menu

Note 1: For a portable application different drives can not be used.

Note 2: Each location block can have different additional Apache directives.

Top

Collective

Using the above two repositories we can move these into a common folder e.g. svn and create a collection of repositories. This common folder may contain more repositories. You can name it whatever you like however it is common practice to use the name svn hence I will stick with that.

Advantage of a collection of repositories only a single location block is required in the Apache configuration file as shown below.

<pre>

<Location /svn>

 DAV svn
 SVNParentPath C:/a_svn/UniServer/svn

</Location> </pre>

  • svn Top level name. Any folder name after this is assumed to be a repository request and passed to DAV for resolving
  • DAV svn Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request.
  • SVNParentPath Absolute path to the parent folder containing all the repositories. C:/a_svn/UniServer/svn

The repositories may be accessed using the following URL:

Note: Entering <nowiki>http://localhost</nowiki>/svn will produce the following error message: <pre> Forbidden You don't have permission to access /svn/ on this server. </pre> Effectively the URL is requesting a page listing all repositories in folder svn.

I personally prefer listing all repositories because it not only saves typing the listed repositories are links. To enable listing add the line shown:

<pre>

<Location /svn>

 DAV svn
 SVNListParentPath on
 SVNParentPath C:/a_svn/UniServer/svn

</Location> </pre>

  • svn Top level name. Any folder name after this is assumed to be a repository request and passed to DAV for resolving
  • DAV svn Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request.
  • SVNListParentPath on Enables listing of all repositories for URL <nowiki>http://localhost</nowiki>/svn
  • SVNParentPath Absolute path to the parent folder containing all the repositories. C:/a_svn/UniServer/svn

Note:

With a collective repository folder, Apache delegates handling of all URLs whose path begin with /svn/ after the domain name to the Subversion DAV layer.

This layer assumes all folders in the directory specified by the SVNParentPath directive are Subversion repositories.

Unlike SVNPath directive, you do not need to add a new location block for each new repository and there is no need to restart Apache. This can be an advantage when adding new repositories since there is no server down time.

Top

Summary

The above overview is intended to provide enough terminology to understand the installation process and repository creation.

Installing subversion on UniServer 5.0-Nano is not difficult remember we are looking at a portable installation. Hence the reason for restricting a repository location the next page provides a step-by-step installation guide.

Top