Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process all matching rules #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Process all matching rules #123

wants to merge 1 commit into from

Conversation

TWiStErRob
Copy link
Contributor

@TWiStErRob TWiStErRob commented Apr 18, 2021

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.

@tnyblom
Copy link
Contributor

tnyblom commented Jul 2, 2021

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.

@TWiStErRob
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants