Multiple Projects per Branch
The Subversion team recommends layout where each project has its own trunk, branches and tags directories where "main line", "divergent copies" and "stable snapshots" of development reside. However, some users prefer another layout, where these directories exist in the SVN repository root and each branch and tag stores multiple projects, so the repository looks like that:
/repository
/trunk
/project_1
/project_2
…
/project_N
/branches
/branch_1
/project_1
/project_2
…
/project_N
/branch_2
/project_1
/project_2
…
/project_N
…
/branch_N
/project_1
/project_2
…
/project_N
/tags
/tag_1
/project_1
/project_2
…
/project_N
/tag_2
/project_1
/project_2
…
/project_N
…
/tag_N
/project_1
/project_2
…
/project_N
and forms the layout that can be called "inverted" as the directories order is reversed.
In this case, mapping scheme is a bit more complex than standard cases; however, the entities are perfectly distinguishable although they reside in nested directories. Here is one big difference though: earlier, we were talking that svn.url
must point to SVN project root - but there's no projects' root here since each project has its directories spread across the repository. So we have to set svn.url
to point to repository root, no matter which one project we want to mirror to Git. E.g., the svn.url
might look like:
http://example.com/svn/repository
and all the mapping paths must be set relative to this URL.
All the projects "main lines" of development reside in /repository/trunk directory, so project_1's "main line" resides in /repository/trunk/project_1. Thus, if you want to mirror project_1 to Git, you can set trunk mapping line like that:
trunk = trunk/project_1:refs/heads/master
which means that full path to SVN trunk
is:
http://example.com/svn/repository/trunk/project_1
The same for branches
and tags
: project_1's "divergent copies" and "stable snapshots" reside in /repository/branches and /repository/tags respectively and thus full mapping scheme might look like this:
trunk = trunk/project_1:refs/heads/master
branches = branches/*/project_1:refs/heads/*
tags = tags/*/project_1:refs/tags/*
shelves = shelves/*/project_1:refs/shelves/*
Another project should be mirrored to another Git repository, but mapping scheme and svn.url
still the same for all the project in such SVN repository. That is, for project_N the mapping scheme looks as follows:
trunk = trunk/project_N:refs/heads/master
branches = branches/*/project_N:refs/heads/*
tags = tags/*/project_N:refs/tags/*
shelves = shelves/*/project_N:refs/shelves/*
and svn.url
must be set the same:
http://example.com/svn/repository
In fact, actual directories names are not important, they can have any names you want to set; but it is crucial to distinguish SVN entities: i.e. trunk, branches and tags can be called main, offshoots and snapshots:
/repository
/main
/project_1
…
/project_N
/offshoots
/offshoot_1
/project_1
…
/project_N
/offshoot_2
/project_1
…
/project_N
…
/offshoot_N
/project_1
…
/project_N
/snapshots
/snapshot_1
/project_1
…
/project_N
/snapshot_2
/project_1
…
/project_N
…
/snapshot_N
/project_1
…
/project_N
but it is crucial they contain correct SVN entities: "main line", "divergent copies" and "stable snapshots". In such case mapping can be set in the same way:
trunk = main/project_N:refs/heads/master
branches = offshoots/*/project_N/*:refs/heads/*
tags = snapshots/*/project_N/*:refs/tags/*