diff --git a/lib/svi/application.rb b/lib/svi/application.rb index 4f5b3f9..756c914 100644 --- a/lib/svi/application.rb +++ b/lib/svi/application.rb @@ -12,11 +12,15 @@ module Svi svn_info(".") end - def checkout(url) - checkout_directory = [] - if url =~ %r{/([^/]+)/trunk$} - checkout_directory << $1 - end + def checkout(url, options = {}) + wc_path = + if options[:wc_path] + options[:wc_path] + elsif url =~ %r{/([^/]+)/trunk$} + $1 + else + url.split("/").last + end last_checkout_message = "" checked_out_paths = [] clear_message = lambda do @@ -33,7 +37,7 @@ module Svi end end start_time = Time.new - SvnRunner.run_svn("checkout", [url] + checkout_directory, allow_interactive: true) do |line| + SvnRunner.run_svn("checkout", [url, wc_path], allow_interactive: true) do |line| if line =~ /^A.{4}(.*)$/ path = $1 checked_out_paths << path diff --git a/lib/svi/cli.rb b/lib/svi/cli.rb index f8137c5..f459b92 100644 --- a/lib/svi/cli.rb +++ b/lib/svi/cli.rb @@ -64,8 +64,8 @@ EOS $stderr.puts "Error: must specify URL" return 1 end - url, = args - @application.checkout(url) + url, wc_path = args + @application.checkout(url, wc_path: wc_path) end def cmd_status(params)