Skip to content

Commit

Permalink
Make revision parsing robust when svn spews warnings.
Browse files Browse the repository at this point in the history
(for example, svn: warning: can't write to /root/.subversion/servers)
  • Loading branch information
smerritt authored and ezmobius committed Jan 4, 2010
1 parent 458b8a6 commit c623566
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/chef-deploy/subversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ def log(from, to=nil)
def query_revision(revision)
return revision if revision =~ /^\d+$/
command = scm(:info, repository, authentication, "-r#{revision}")
result = yield(command)
yaml = YAML.load(result)
raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml
yaml['Last Changed Rev'] || yaml['Revision']
command_output = yield(command)
result = {}
command_output.each_line do |line|
key, value = line.split(/:/, 2)
result[key] = value if key && value
end
rev = result['Last Changed Rev'] || result['Revision']
raise "tried to run `#{command}' and got unexpected result #{command_output}" unless rev
rev
end

# Increments the given revision number and returns it.
Expand Down

0 comments on commit c623566

Please sign in to comment.