@@ -47,8 +47,8 @@ def parse(args)
47
47
options [ :nominimizeurl ] = false
48
48
options [ :rootistrunk ] = false
49
49
options [ :trunk ] = 'trunk'
50
- options [ :branches ] = 'branches'
51
- options [ :tags ] = 'tags'
50
+ options [ :branches ] = [ ]
51
+ options [ :tags ] = [ ]
52
52
options [ :exclude ] = [ ]
53
53
options [ :revision ] = nil
54
54
options [ :username ] = nil
@@ -83,12 +83,12 @@ def parse(args)
83
83
options [ :trunk ] = trunk
84
84
end
85
85
86
- opts . on ( '--branches BRANCHES_PATH' , 'Subpath to branches from repository URL (default: branches)' ) do |branches |
87
- options [ :branches ] = branches
86
+ opts . on ( '--branches BRANCHES_PATH' , 'Subpath to branches from repository URL (default: branches); can be used multiple times ' ) do |branches |
87
+ options [ :branches ] << branches
88
88
end
89
89
90
- opts . on ( '--tags TAGS_PATH' , 'Subpath to tags from repository URL (default: tags)' ) do |tags |
91
- options [ :tags ] = tags
90
+ opts . on ( '--tags TAGS_PATH' , 'Subpath to tags from repository URL (default: tags); can be used multiple times ' ) do |tags |
91
+ options [ :tags ] << tags
92
92
end
93
93
94
94
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
@@ -182,28 +182,42 @@ def clone!
182
182
if rootistrunk
183
183
# Non-standard repository layout. The repository root is effectively 'trunk.'
184
184
cmd = "git svn init --prefix=svn/ "
185
- cmd += "--username=#{ username } " unless username . nil?
186
- cmd += "--password=#{ password } " unless password . nil?
185
+ cmd += "--username=' #{ username } ' " unless username . nil?
186
+ cmd += "--password=' #{ password } ' " unless password . nil?
187
187
cmd += "--no-metadata " unless metadata
188
188
if nominimizeurl
189
189
cmd += "--no-minimize-url "
190
190
end
191
- cmd += "--trunk=#{ @url } "
191
+ cmd += "--trunk=' #{ @url } ' "
192
192
run_command ( cmd , true , true )
193
193
194
194
else
195
195
cmd = "git svn init --prefix=svn/ "
196
196
197
197
# Add each component to the command that was passed as an argument.
198
- cmd += "--username=#{ username } " unless username . nil?
199
- cmd += "--password=#{ password } " unless password . nil?
198
+ cmd += "--username=' #{ username } ' " unless username . nil?
199
+ cmd += "--password=' #{ password } ' " unless password . nil?
200
200
cmd += "--no-metadata " unless metadata
201
201
if nominimizeurl
202
202
cmd += "--no-minimize-url "
203
203
end
204
- cmd += "--trunk=#{ trunk } " unless trunk . nil?
205
- cmd += "--tags=#{ tags } " unless tags . nil?
206
- cmd += "--branches=#{ branches } " unless branches . nil?
204
+ cmd += "--trunk='#{ trunk } ' " unless trunk . nil?
205
+ unless tags . nil?
206
+ # Fill default tags here so that they can be filtered later
207
+ tags = [ 'tags' ] if tags . empty?
208
+ # Process default or user-supplied tags
209
+ tags . each do |tag |
210
+ cmd += "--tags='#{ tag } ' "
211
+ end
212
+ end
213
+ unless branches . nil?
214
+ # Fill default branches here so that they can be filtered later
215
+ branches = [ 'branches' ] if branches . empty?
216
+ # Process default or user-supplied branches
217
+ branches . each do |branch |
218
+ cmd += "--branches='#{ branch } ' "
219
+ end
220
+ end
207
221
208
222
cmd += @url
209
223
@@ -224,8 +238,8 @@ def clone!
224
238
regex = [ ]
225
239
unless rootistrunk
226
240
regex << "#{ trunk } [/]" unless trunk . nil?
227
- regex << "#{ tags } [/][^/]+[/]" unless tags . nil?
228
- regex << "#{ branches } [/][^/]+[/]" unless branches . nil?
241
+ tags . each { | tag | regex << "#{ tag } [/][^/]+[/]" } unless tags . nil? or tags . empty ?
242
+ branches . each { | branch | regex << "#{ branch } [/][^/]+[/]" } unless branches . nil? or branches . empty ?
229
243
end
230
244
regex = '^(?:' + regex . join ( '|' ) + ')(?:' + exclude . join ( '|' ) + ')'
231
245
cmd += "--ignore-paths='#{ regex } ' "
0 commit comments