5 if current_repository_matches_target_repository?
6 c = scm :update, @new_resource.svn_arguments, verbose, authentication, "-r#{revision_int}", @new_resource.destination
7 Chef::Log.debug "#{@new_resource} updated working copy #{@new_resource.destination} to revision #{@new_resource.revision}"
9 c = scm :switch, @new_resource.svn_arguments, verbose, authentication, "-r#{revision_int}", @new_resource.repository, @new_resource.destination
10 Chef::Log.debug "#{@new_resource} updated working copy #{@new_resource.destination} to #{@new_resource.repository} revision #{@new_resource.revision}"
15 def current_repository
16 @current_repository ||= repo_attrs['URL']
19 def current_repository_matches_target_repository?
20 (!current_repository.nil?) && (@new_resource.repository == current_repository)
24 return {} unless ::File.exist?(::File.join(@new_resource.destination, ".svn"))
26 @repo_attrs ||= svn_info.lines.inject({}) do |attrs, line|
27 if line =~ SVN_INFO_PATTERN
28 property, value = $1, $2
29 attrs[property] = value
31 raise "Could not parse `svn info` data: #{line}"
39 status, svn_info, error_message = output_of_command(command, run_options(:cwd => cwd))
41 unless [0,1].include?(status.exitstatus)
42 handle_command_failures(status, "STDOUT: #{svn_info}\nSTDERR: #{error_message}")