From 671d107be87210b67c03bf8cf9988773c61ceea3 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 26 Aug 2015 09:42:05 -0600 Subject: [PATCH 1/3] Fix --rootistrunk --- lib/svn2git/migration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index bd0f6b2..23883b0 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -188,7 +188,7 @@ def clone! if nominimizeurl cmd += "--no-minimize-url " end - cmd += "--trunk=#{@url}" + cmd += @url run_command(cmd, true, true) else From b9f1547e0258602cea688678be16ec9aa4de75be Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 26 Aug 2015 11:20:42 -0600 Subject: [PATCH 2/3] Really fix --rootistrunk --- lib/svn2git/migration.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index 23883b0..c7fa547 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -45,7 +45,6 @@ def parse(args) options[:verbose] = false options[:metadata] = false options[:nominimizeurl] = false - options[:rootistrunk] = false options[:trunk] = 'trunk' options[:branches] = 'branches' options[:tags] = 'tags' @@ -92,7 +91,6 @@ def parse(args) end opts.on('--rootistrunk', 'Use this if the root level of the repo is equivalent to the trunk and there are no tags or branches') do - options[:rootistrunk] = true options[:trunk] = nil options[:branches] = nil options[:tags] = nil @@ -172,7 +170,6 @@ def clone! tags = @options[:tags] metadata = @options[:metadata] nominimizeurl = @options[:nominimizeurl] - rootistrunk = @options[:rootistrunk] authors = @options[:authors] exclude = @options[:exclude] revision = @options[:revision] @@ -222,11 +219,9 @@ def clone! # Add exclude paths to the command line; some versions of git support # this for fetch only, later also for init. regex = [] - unless rootistrunk - regex << "#{trunk}[/]" unless trunk.nil? - regex << "#{tags}[/][^/]+[/]" unless tags.nil? - regex << "#{branches}[/][^/]+[/]" unless branches.nil? - end + regex << "#{trunk}[/][^/]+[/]" unless trunk.nil? || trunk == '/' + regex << "#{tags}[/][^/]+[/]" unless tags.nil? + regex << "#{branches}[/][^/]+[/]" unless branches.nil? regex = '^(?:' + regex.join('|') + ')(?:' + exclude.join('|') + ')' cmd += "'--ignore-paths=#{regex}'" end From b0c49fbaacb41cdd483cc561ca5082fa2f8b19c9 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 26 Aug 2015 10:43:40 -0600 Subject: [PATCH 3/3] Add --shared option --- lib/svn2git/migration.rb | 53 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index c7fa547..7525bdb 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -53,6 +53,7 @@ def parse(args) options[:username] = nil options[:password] = nil options[:rebasebranch] = false + options[:shared] = nil if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE)) options[:authors] = DEFAULT_AUTHORS_FILE @@ -136,6 +137,16 @@ def parse(args) options[:rebasebranch] = rebasebranch end + opts.on('--shared=[SHARED]', 'Set --shared option for git init') do |shared| + if shared + options[:shared] = "=#{shared}" + else + # git svn init seems to require an option, otherwise we'd leave + # this blank + options[:shared] = '=group' + end + end + opts.separator "" # No argument, shows at tail. This will print an options summary. @@ -175,37 +186,25 @@ def clone! revision = @options[:revision] username = @options[:username] password = @options[:password] + shared = @options[:shared] - if rootistrunk - # Non-standard repository layout. The repository root is effectively 'trunk.' - cmd = "git svn init --prefix=svn/ " - cmd += "--username=#{username} " unless username.nil? - cmd += "--password=#{password} " unless password.nil? - cmd += "--no-metadata " unless metadata - if nominimizeurl - cmd += "--no-minimize-url " - end - cmd += @url - run_command(cmd, true, true) + cmd = "git svn init --prefix=svn/ " - else - cmd = "git svn init --prefix=svn/ " - - # Add each component to the command that was passed as an argument. - cmd += "--username=#{username} " unless username.nil? - cmd += "--password=#{password} " unless password.nil? - cmd += "--no-metadata " unless metadata - if nominimizeurl - cmd += "--no-minimize-url " - end - cmd += "--trunk=#{trunk} " unless trunk.nil? - cmd += "--tags=#{tags} " unless tags.nil? - cmd += "--branches=#{branches} " unless branches.nil? + # Add each component to the command that was passed as an argument. + cmd += "--username=#{username} " unless username.nil? + cmd += "--password=#{password} " unless password.nil? + cmd += "--no-metadata " unless metadata + if nominimizeurl + cmd += "--no-minimize-url " + end + cmd += "--trunk=#{trunk} " unless trunk.nil? + cmd += "--tags=#{tags} " unless tags.nil? + cmd += "--branches=#{branches} " unless branches.nil? + cmd += "--shared#{shared} " unless shared.nil? - cmd += @url + cmd += @url - run_command(cmd, true, true) - end + run_command(cmd, true, true) run_command("#{git_config_command} svn.authorsfile #{authors}") unless authors.nil?