Page tree

All Branches in a Single Directory

The next common SVN projects layout is, in fact, no layout: all the SVN directories - branches, tags and all - just lay in project's root or inside its subdirectories, not following any placement conventions or certain layouts. Having such a layout it's a good idea to follow some naming convention at least, but generally, directories names don't follow any conventions either. So the SVN project might look like this:

            /bug_1224           # branch
            /issue1678          # branch
            /features           # second level directory
                /f4536          # branch
                /feat 4589      # branch
            /main               # "main line" (trunk)
            /v.1.5.6_b3345      # some tag (snapshot)
            /1.5.7 build 7890   # some tag (snapshot)

SubGit can handle such SVN layout, but it could be quite effortful to create correct mapping scheme to mirror SVN project of that design. If the directories placement doesn't follow any layout and directories names don't follow any conventions, then the only way to map each and every SVN entity to Git counterpart is to create excplicit mapping for every directory. Thus for the Project)N above the mapping scheme can be set like this:

trunk = main:refs/heads/master
    branches = bug_1224:refs/heads/bug_1224
    branches = issue1678:refs/heads/issue1678
    branches = features/f4536:refs/heads/f4536
    branches = features/feat 4589:refs/heads/feat 4589
    tags = v.1.5.6_b3345:refs/tags/v.1.5.6_b3345
    tags = 1.5.7 build 7890:refs/tags/1.5.7 build 7890

The svn.url must point to the Project_N root, so it must be set as:

url =

Of course, it might be rather laborious to create an explicit mapping for big projects - but unfortunately, it's the only way if no conventions followed. If, say, directories name do follow certain convention (or just have some similarities, even occasional), then wildcard can be used to map a bunch of branches (or tags) together and it can make the mapping process much easier. Suppose, the branches names follow name patterns "bugxxxx", "issuexxxx" or "fxxxx", and all the tags called like "v.x.x.xxxxx" or "snapshotxxxx", i.e. the Project_N layout looks like this:

            /bug_1224           #branch
            /bug_2379           #branch
            /bug_2471           #branch
            /issue_1678         #branch
            /issue_1890         #branch
            /issue_2021         #branch
            /features           #second level directory
                /f4536          #branch
                /f4589          #branch
                /f4602          #branch
            /main               #"main line" (trunk)
            /v.1.5.6_b3345      #some tag (snapshot)
            /v.1.5.7_b7890      #some tag (snapshot)
            /snapshot_3329      #some tag (snapshot)
            /snapshot_3431      #some tag (snapshot)

then the mapping can be set like this:

trunk = main:refs/heads/master
    branches = bug_*:refs/heads/bug_*
    branches = issue_*:refs/heads/issue_*
    branches = features/f*:refs/heads/f*
    tags = v.*:refs/tags/v.*
    tags = snapshot_*:refs/tags/snapshot_*

This will mirror all the present SVN branches and tags to Git repository.

Another approach to mirror such unordered layout and to make it ordered: that is, change the project layout so that the project follows some convention - e.g. SVN recommended layout. It can bring many advantages even besides SubGit mirroring facilitation, though such a relayout can be very hard. And additionally, such SVN project relayout brings some peculiarity to SubGit mirroring as well, it's described in the next section.

  • No labels