Skip to content
This repository was archived by the owner on Jan 24, 2021. It is now read-only.

Commit 92af33f

Browse files
Stephan Leicht VogtStephan Leicht Vogt
Stephan Leicht Vogt
authored and
Stephan Leicht Vogt
committed
Merge remote-tracking branch 'oomathias/master'
2 parents bc5df18 + 8607e0b commit 92af33f

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

lib/svn2git/migration.rb

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def run!
2828
else
2929
clone!
3030
end
31-
fix_tags
3231
fix_branches
32+
fix_tags
3333
optimize_repos
3434
end
3535

@@ -41,8 +41,8 @@ def parse(args)
4141
options[:nominimizeurl] = false
4242
options[:rootistrunk] = false
4343
options[:trunk] = 'trunk'
44-
options[:branches] = 'branches'
45-
options[:tags] = 'tags'
44+
options[:branches] = []
45+
options[:tags] = []
4646
options[:exclude] = []
4747
options[:revision] = nil
4848
options[:username] = nil
@@ -88,11 +88,11 @@ def parse(args)
8888
end
8989

9090
opts.on('--branches BRANCHES_PATH', 'Subpath to branches from repository URL (default: branches)') do |branches|
91-
options[:branches] = branches
91+
options[:branches] << branches
9292
end
9393

9494
opts.on('--tags TAGS_PATH', 'Subpath to tags from repository URL (default: tags)') do |tags|
95-
options[:tags] = tags
95+
options[:tags] << tags
9696
end
9797

9898
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
@@ -153,6 +153,15 @@ def parse(args)
153153
end
154154

155155
@opts.parse! args
156+
157+
# Set default branches and tags if not explicitely configured
158+
if ! options[:branches].nil? && options[:branches].length == 0
159+
options[:branches] << 'branches'
160+
end
161+
if ! options[:tags].nil? && options[:tags].length == 0
162+
options[:tags] << 'tags'
163+
end
164+
156165
options
157166
end
158167

@@ -203,8 +212,12 @@ def clone!
203212
cmd += "--no-minimize-url "
204213
end
205214
cmd += "--trunk=#{trunk} " unless trunk.nil?
206-
cmd += "--tags=#{tags} " unless tags.nil?
207-
cmd += "--branches=#{branches} " unless branches.nil?
215+
tags.each do |tags|
216+
cmd += "--tags=#{tags} "
217+
end unless tags.nil?
218+
branches.each do |branches|
219+
cmd += "--branches=#{branches} "
220+
end unless branches.nil?
208221

209222
cmd += @url
210223

@@ -336,7 +349,7 @@ def fix_branches
336349

337350
svn_branches.each do |branch|
338351
branch = branch.gsub(/^svn\//,'').strip
339-
if @options[:rebase] && (@local.include?(branch) || branch == 'trunk')
352+
if @options[:rebase] && (@local.include?(branch) || branch == 'trunk') && !(branch == 'trunk' && @options[:trunk].nil?)
340353
lbranch = branch
341354
lbranch = 'master' if branch == 'trunk'
342355
if @options[:bare] && _repos != '' && __cmd != ''

0 commit comments

Comments
 (0)