checkout: accept wc_path optional argument

This commit is contained in:
Josh Holtrop 2018-03-06 22:56:28 -05:00
parent d96141f57d
commit 96010f2590
2 changed files with 12 additions and 8 deletions

View File

@ -12,11 +12,15 @@ module Svi
svn_info(".") svn_info(".")
end end
def checkout(url) def checkout(url, options = {})
checkout_directory = [] wc_path =
if url =~ %r{/([^/]+)/trunk$} if options[:wc_path]
checkout_directory << $1 options[:wc_path]
end elsif url =~ %r{/([^/]+)/trunk$}
$1
else
url.split("/").last
end
last_checkout_message = "" last_checkout_message = ""
checked_out_paths = [] checked_out_paths = []
clear_message = lambda do clear_message = lambda do
@ -33,7 +37,7 @@ module Svi
end end
end end
start_time = Time.new 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}(.*)$/ if line =~ /^A.{4}(.*)$/
path = $1 path = $1
checked_out_paths << path checked_out_paths << path

View File

@ -64,8 +64,8 @@ EOS
$stderr.puts "Error: must specify URL" $stderr.puts "Error: must specify URL"
return 1 return 1
end end
url, = args url, wc_path = args
@application.checkout(url) @application.checkout(url, wc_path: wc_path)
end end
def cmd_status(params) def cmd_status(params)