svn2git
svn2git copied to clipboard
Process all matching rules
I have an SVN mono-repository, which has the following structure (unrelated stuff not listed):
/Projects/project1
/Projects/project1/libs (svn:externals)
/Projects/project2
/Projects/project2/libs (svn:externals)
/Libraries/library1/library2 (svn:externals)
/Libraries/library2
and I would like to get three git repos for project1 and project2 and library1. This is easy, except both those projects reference both libraries as svn:externals on libs folders (^ means relative to same SVN repo):
library1 ^/Libraries/library1
library2 ^/Libraries/library2
there were many times when I committed to these projects and the libraries in the same commit.
I was thinking to set up rules like so:
create repository project1.git
end repository
match /Projects/project1/
repository project1.git
branch master
prefix /
end match
match /Libraries/library1/
repository project1.git
branch master
prefix /libs/library1/
end match
match /Libraries/library2/
repository project1.git
branch master
prefix /libs/library2/
end match
create repository project2.git
end repository
match /Projects/project2/
repository project2.git
branch master
prefix /
end match
match /Libraries/library1/
repository project2.git
branch master
prefix /libs/library1/
end match
match /Libraries/library2/
repository project2.git
branch master
prefix /libs/library2/
end match
create repository library1.git
end repository
match /Libraries/library1/
repository library1.git
branch master
prefix /
end match
match /Libraries/library2/
repository library1.git
branch master
prefix /library2/
end match
and my expectation was that each shared commit will end up in every resulting repository so I would have a full history of the library by itself and the full history of the libs is also included in both projects.
This didn't work, so I hacked together the solution in this PR, which I wanted to share. It doesn't fully work, the resulting libs folders are not all equal, but much more usable for me than what master of svn2git produces. Would it make sense to have this as a feature with a command line flag?
For now I think I'll go with splitting my rules up and processing the source repo multiple times.
I'm really scared this will have unexpected side effects. A better solution would be to just run the conversion 3 times, once for each repo.
I did that, @tnyblom, in the end. Would it make sense to detect this configuration and error on it? Because, at the moment, master is not failing and not producing the expected result either.