Fixed that Redmine::VERSION.revision returns nil with svn 1.7 (#12012).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10616 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-10-12 14:09:58 +00:00
parent 2b797fa82f
commit 7af1504672
1 changed files with 6 additions and 13 deletions

View File

@ -12,26 +12,19 @@ module Redmine
# * trunk: devel # * trunk: devel
BRANCH = 'devel' BRANCH = 'devel'
# Retrieves the revision from the working copy
def self.revision def self.revision
revision = nil if File.directory?(File.join(Rails.root, '.svn'))
entries_path = "#{Rails.root}/.svn/entries"
if File.readable?(entries_path)
begin begin
f = File.open(entries_path, 'r') path = Redmine::Scm::Adapters::AbstractAdapter.shell_quote(Rails.root.to_s)
entries = f.read if `svn info --xml #{path}` =~ /revision="(\d+)"/
f.close return $1.to_i
if entries.match(%r{^\d+})
revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s})
else
xml = REXML::Document.new(entries)
revision =
xml.elements['wc-entries'].elements[1].attributes['revision'].to_i
end end
rescue rescue
# Could not find the current revision # Could not find the current revision
end end
end end
revision nil
end end
REVISION = self.revision REVISION = self.revision