Branches mapping overview.

Branches mapping is a set of rules that establish a correspondence between SVN and Git branches and tags. These rules are defined by branches mapping configuration options in SubGit configuration file.

Branches and Tags in Subversion.

There are few key Subversion concepts, that matter in the context of SubGit mapping process:

A SVN repository can be organized in any way and SubGit can deal with any possible SVN repository layout.

A graphical representation of the explained SVN concepts:

Branches and Tags in Git

Unlike SVN, which stores data in the form of a filesystem tree, Git represents its data as a set of snapshots of a filesystem, that is being stored in Git's objects database. Due to this difference, most of Git concepts differ from their SVN counterparts albeit have the same names:

A graphical representation of the explained Git concepts:

SVN to Git mapping


Mapping Configuration Options

All the mapping configuration assembled in SubGit configuration file. The configuration file is being created at the SVN-to-Git translation beginning by SubGit's configure subcommand. The file is situated in subgit subdirectory inside a newly created Git repository:

/GIT_REPOS_PATH
    …
    /subgit
       …
       config

Here is an example of how the [svn] of the configuration file may look like:

[svn]
    url = http://svn.example.com/svn/repository_1/project_1
    trunk = trunk:refs/heads/master
    branches = branches/*:refs/heads/project_1/*
    branches = features_*:refs/heads/features/*
    tags = tags/*:refs/tags/*
    shelves = shelves/*:refs/shelves/*
    excludeBranches = features/feat_4510
    excludePath = *.exe


All the mapping settings reside in [svn] configurations section. There are three main settings groups:

* A SVN repository path setting:
- url - a URL leading to the SVN project.

* Direct mapping settings *[mapping settings per se]*:
- trunk - a path, relative to the URL, that leads to project's trunk.
- branches - a relative path to a directory, containing branches, or a path to a particular branch.
- tags - a relative path to a directory, containing tags, or a path to a particular tag.
- shelves - a relative path to a directory, where *shelves* will be kept.

* Mapping fine tuning settings:
- excludeBranches - a relative path or path pattern with one wildcard, that point to branches or tags, that should be excluded from translation.
- excludeTags - same as *excludeBranches*.
- excludePath - an expression, representing files to be excluded from the translation.
- includePath - an expression, representing files to be included in the translation.