create-repository-svn

Manage tagged legacy code by Subversion

Arno-Can Uestuensoez @ Ingenieurbuero Arno-Can Uestuensoez

Revision History
January 2015

Abstract

The create-repository-svn tool provides the creation of initial repositories from multiple source code directory trees in Subversion based repositories.

The create-repository-svn tool provides particularly the automated creation of release tags, and manages any modification between the releases appropriately.

This could be e.g. one directory tree for each revision, which is transformed to a release tag within the SVN repository. The release tag could be customized arbitrarly by configuration files, thus the management of legacy code and patches could be handled as required. The creation of repositories from legacy code of multiple versions and patch releases becomes as a result simply a call of the included script and could be easily recreated as often as required.

This project is just targeted as a small shell utility for developers. Thus should be adapted personally as required. Common issues will be fixed in the public source.

From project create-repository-svnWork - @repository:


Chapter 1. Components

Architecture

The tools provided with create-repository-svn create a local repository based on Subversion. Therefore a configuration variable is set with a list of tag names, which are names of directory trees. These directory trees contain a complete release or a patch version including common parts from the previous version. The tools work out the provided list from the beginning to the end. For any element in the list the differences to the previous element are considered as changes to the previous release. Thus these are either added into or deleted from the Subversion repository.

Each version is tagged by the name of the directory subtree. Thus should be named appropriately in order to reflect release tags.

Once the local repository is created this could be synchronised to a remote repository e.g. as hosted by googlecode.com and sourceforge.net.

The result is the automated creation of a Subversion repository from a collection of subdirectory trees for each revision.

Interfaces

The interfaces are simply the SVN configuration and the setting of shell variables used in the scripts.

For additional information refer to the comments contained in the script and configuration sources.

Features

The "create-repository-svn" tool supports in current release following features:

  • The automation of repository creation for Subversion repositories.
  • The creation of release tags within a Subversion repository. Either by default names or an arbitrary custom string for each release.
  • The release/tags structure could be altered in several vays by the environment variable TAGS_ANCHOR. The variable allows for configuration of either a single or multiple projects within the tags directory of one local Subversion repository. This e.g. provides multiple variants of the same version of a project to be handled based on one common release tag.
  • The behaviour of the script could be altered in various way by setting environment variables. For further information refer to the script sources.
  • The documentation contains a pattern for "uploading" the local repository by usage of "svnsync" into developer repositories on "googlecode.com".

Chapter 2. Project Sources

The layout of the source trees is organized for the management by the Eclipse IDE. The sources are splitted into the runtime sources and the documentation sources. The documentation is created by the DocBook plugin within the Eclipse IDE.

The project sources comprise:

  • Runtime system sources

    The source code for the runtime system is organized into the subtrees

    • bld

      Components to be used to create the runtime environment.

    • rt

      Components representing the runtime environment. These could be simply copied to the target environment. Here the HOME directory of the user.

    • tests

      Build sources for required test envitronment.

      Not required for current release.

  • Documentation sources

    The documentation sources are contained in the "docsrc" directory. This contains for each language a specific subdirectory. The build process is in the Eclipse environment executed as an Ant task. Thus the call interface is given by the file "build.xml". The sources are defined in the structure within the source file "docbook.xml" contained within the "src" subdirectory.

    The build target is the "doc" directory in project root.

  • Test data

    The "tests" directory in project root contains test data for the creation of a simple repository. This is an initial example.

    The subdirectory contains 4 releases of a demo source. These are imported into the created new SVN repository as different tags.

Chapter 3. Installation

Update the SVN configuration

First merge the required parts of the configuration file for Subversion from the source subdirectory "src/bld/HOME/.subversion/config" into the configuration file either in your home directory, or in to the "/etc/subversion/config" file.

Install the create-repository-svn tool

For the installation of the command line tool just copy the "src/rt" directory contents into your HOME directory.

Install the documentation

For the installation of the documentation just copy the "doc" directory contents into your HOME directory.

Chapter 4. Howto

The tools were used particularly to migrate several versions of the UnifiedSessionsManager ©2007 project into the SVN repository on googlecode.com and from there into sourceforge.net. Thus an example could be found at:

https://code.google.com/p/unified-sessions-manager/

Create a local repository

The example repository is foreseen to be created first as a local repository. In a second step the local repository is mirrored into the remote repository, e.g. hosted in "code.google.com".

The following steps are required for the creation of the local repository:

  1. Change into the "tests" directory in project root.

  2. Clean eventual old releases e.g. by "rm -rf svn-local tmp"

  3. Source the environment file "releases-tags.cfg".

  4. Call the tool "create-repos-release-meta-sets.sh".

  5. Call the tool "create-repos-releases.sh".

The result is as given in following figure.

Figure 4.1. Initial multi-tagged repository

Initial multi-tagged repository


The local repository is now prepared.

Change the tags directory hierarchy

The "tags" subdirectory is by default a flat structure foreseen for the containement of one project with multiple releases. This is for the application as an initial local mediation repository perfectly suitable.

In case of multiple projects to be contained in the local cache, the option TAGS_ANCHOR should be set appropriately. The following could be applied:

  • TAGS_ANCHOR=0

    Default, flat structure for a single project.

    Result is: REPOT=${REPOT}/${REL[current]}

    Figure 4.2. TAGS_ANCHOR=0 - Default

    TAGS_ANCHOR=0 - Default


  • TAGS_ANCHOR=1

    The project name is used as collection root for the tags, to be used when multiple projects are included.

    Result is: REPOT=${REPOT}/${PROJECT}/${REL[current]}

    Figure 4.3. TAGS_ANCHOR=1

    TAGS_ANCHOR=1


  • TAGS_ANCHOR=2

    The project name is used as root within each tag. This may be used, when related projects and subprojects are commonly versioned for compatibility reasons. E.g. a documentation and source project have to match the same version.

    Result is: REPOT=${REPOT}/${REL[current]}/${PROJECT}

    Figure 4.4. TAGS_ANCHOR=2

    TAGS_ANCHOR=2


Define custom tags and commit messages

The "tags" subdirectory names for the filesystem releases are named by default the same as the containing directory name provided by the "REL" variable.

This behaviour could be altered by a file named "tag.cfg" placed in the top directory of each filesystemrelease. The file is sourced into the namescope of the running script, thus defined variables superpose predefined values.

Currently the following variables are provided/tested:

  • TAG

    The tag name within the repository, replaces RELEASE name as repository tag.

  • MESSAGE

    A custom commit message.

Synchronise to code.google.com

The next steps are required for the initial creation of a remote repository.

  1. Create a google-account and login to your account.

  2. Create a google code project, from "MyFavorites->Create Project".

    Base of project becomes e.g.: https://code.google.com/p/create-repository-svn/

  3. Aquire a "googlecode.com password".

    Base is: https://code.google.com/hosting/settings

  4. Reset your repository - but be aware of the consequences. The reset deletes any repository content, thus you have to initially restore the contents. This is for the initial creation perfecly suitable, because some default entries are the only content for this case until now.

    The reset linkt is at the time of writing near the bottom of the page.

    Base is: https://code.google.com/p/create-repository-svn/source/checkout

    Now you have an empty repository for the fresh initial setup by mirroring your local subversion repository.

  5. Change into the "src/tests" directory.

  6. Check contents of the file "remote-repository-code-google-com.cfg" for the required remote settings and adapt the remote account and repository as required.

    Source the environment file "remote-repository-code-google-com.cfg".

  7. Once the local settings are completed the remote synchronisation to the google-code repository is performed by call of "svnsyc". This requires the use of the google code repository password, which you can get and regenerate within your google developer account.

    Than call first:

    YOURACCOUNT=your-account@gmail.com
    YOURPROJECT=https://your-project.googlecode.com/svn
    YOURLOCALREPOSITORY=file:///you/local/path/to/local/repository/svn-local
    
    svnsync init --username $YOURACCOUNT $YOURPROJECT $YOURLOCALREPOSITORY
    

    Following call:

    YOURACCOUNT=your-account@gmail.com
    YOURPROJECT=https://your-project.googlecode.com/svn
    YOURLOCALREPOSITORY=file:///you/local/path/to/local/repository/svn-local
    
    svnsync sync --username $YOURACCOUNT $YOURPROJECT $YOURLOCALREPOSITORY
    

    When a proxy is required, e.g. call for Tor proxies:

    torsocks svnsync init --username $YOURACCOUNT $YOURPROJECT $YOURLOCALREPOSITORY
    

  8. If required call in case of lock errors:

    torsocks svnsync sync --steal-lock --username $YOURACCOUNT $YOURPROJECT
    

  9. The following example is valid for this project.

    YOURACCOUNT=my-account@gmail.com
    YOURPROJECT=https://create-repository-svn.googlecode.com/svn
    YOURLOCALREPOSITORY=file://${PWD}/svn-local
    
    tsocks svnsync init --username $YOURACCOUNT $YOURPROJECT $YOURLOCALREPOSITORY
    

Appendix A. Projects Web Resources

From project create-repository-svnWork - @repository:

The codes is available as:

  1. As repository: SVN:create-repository-svn.

The online documentation is available from:

Appendix B. License

Code

The license is GPL-3, refer to the contained file gpl3.txt or to

	    http://www.gnu.org/licenses/gpl.html

Documentation

This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.

The license is CCL, whith attribution "CC BY-SA" refer to

			https://creativecommons.org/licenses/by-sa/4.0/