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(".")
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

View File

@ -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)