Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Single Directory

This layout is probably the simplest possible case to map since there's only one single directory, with no branches or tags or any nested directories that can make the mapping more complex. Actually, this approach can apply to several different layouts: it can be some relatively simple SVN repository that has no branches or tags and all the files live right in repository's root:

/repository
        file1
        file2
        …
        fileN

In this case, all that is needed to translate the project into Git is to set svn.url to point to SVN repository's root directory:

http://example.com/svn/repository

And all the trunk, branches, tags and shelves setting in SubGit's configuration file can be either commented:

#trunk = trunk:refs/heads/master
    #branches = branches/*:refs/heads/*
    #tags = tags/*:refs/tags/*
    #shelves = shelves/*:refs/shelves/*

or just removed.

Note, that in such case (repository root is used) it's impossible to add branches or tags later on.

The same approach applies to the case when all the files reside in project's (not repository) root directory: that is, each project in repository has its own directory, but the project being translated has no branches and tags and all the files are situated right in project's root:

/repository
        /project_1
            file1
            file2
            …
            fileN
        /project_2
            …
        …
        /project_N

Similarly, we can just set svn.url to point to project root:

http://example.com/svn/repository/project_1

and comment the mapping settings:

#trunk = trunk:refs/heads/master
    #branches = branches/*:refs/heads/*
    #tags = tags/*:refs/tags/*
    #shelves = shelves/*:refs/shelves/*

or remove them at all.

Unlike the first case though, the mapping for this layout can be set in one more way: we can set the svn.url to point the repository root directory:

http://example.com/svn/repository

and set project directory to be trunk:

trunk = project_1:refs/heads/master
    #branches = branches/*:refs/heads/*
    #tags = tags/*:refs/tags/*
    #shelves = shelves/*:refs/shelves/*

This approach will also translate the project to Git; but additionally, branches and tags can be created and added to translation later with almost no configuration effort since project's directory acts as a trunk.

One more common case is that only one particular branch has to be translated to Git. The repository and project can be arbitrary complex, e.g.:

/svn
      /repository
         /project
            /trunk
            /branches
                /branch_1
                …
            /bugs
                …
            /features
                …
            /tags
                …
            /major_releases
                
            /minor_releases
                …

but if only branch_1 needs to be translated - it can be done as simply as

url = http://example.com/svn/repository/project/branches

    trunk = branch_1:refs/heads/master
    #branches = branches/*:refs/heads/*
    #tags = tags/*:refs/tags/*
    #shelves = shelves/*:refs/shelves/*

that is, we set svn.url to point to the branches directory inside the project directory and set branch_1 to be trunk.

Another way is to set svn.url to point directly to the branch_1 directory:

url = http://example.com/svn/repository/project/branches/branch_1

and comment (or remove) all the rest options:

#trunk = trunk:refs/heads/master
    #branches = branches/*:refs/heads/*
    #tags = tags/*:refs/tags/*
    #shelves = shelves/*:refs/shelves/*

Both ways are equivalent - the branch_1 will be translated into Git's master branch.

  • No labels