Browse files

Make revision parsing robust when svn spews warnings.

(for example, svn: warning: can't write to /root/.subversion/servers)
  • Loading branch information...
1 parent 458b8a6 commit c623566b260cbb409aad67f6d61c01a409b848ec @smerritt smerritt committed with ezmobius Dec 9, 2009
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/chef-deploy/subversion.rb
View
13 lib/chef-deploy/subversion.rb
@@ -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.

0 comments on commit c623566

Please sign in to comment.