Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Single Directory

This layout is probably the simplest possible case to map since The single directory layout means 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:

where everything resides. The simplest case is that where all the files and directories reside right in the repository root and there are no branches or tags:

No Format
nopaneltrue
/repository
	dir1
	…
	dirN
	file1
	…
	fileN

Correct configuration for this case is the following:

No Format
[svn]
	url = http://example.com/svn/repository

...

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




	#trunk = 

...

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

...

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:


Another kind of the single directory layout is an SVN repository hosting more than one project, each project lives in its own directory inside the repository and each projects' files are stored right in the project directory root:

No Format
nopaneltrue
/repository
	/project_1
		dir1
		…
		dirN
		file1
		…
		fileN
	/project_2
	…
	/project_N

There are two possible configurations for this case.

In the first, the URL is set leading to the project root and all the mapping options are disabled:

No Format
[svn]
	url = http://example.com/svn/repository/project_1

...

and comment the mapping settings:



	#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:

Note that this configuration doesn't allow to add branches and tags later.

Another possible configuration for this case is that the URL leads to the repository and trunk option is set to point to project directory:

No Format
[svn]
	url = 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 In this 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.:

...

configuration later just by enabling appropriate line in the configuration.


This single directory layout approach can also be applied in a case when only one branch from a repository should be translated. 

For example, a Subversion repository can stick to standard layout:

No Format
nopaneltrue
/svn
	/repository
		/project
			/trunk
			/branches
				/branch_1
				…            

...


			/tags
				…         

...

   

...

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

However, if branch_1 only is intended for the translation, then it can be done by the single directory layout approach using the configuration below:

No Format
[svn]
	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 Another way to express the same configuration is to set svn.url to point  leading directly to the branch_1 directory:

No Format
[svn]
	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 branchThe difference between these two configurations is that branches or tags can be added later to the first configuration, whereas nothing can be added to the second.