summaryrefslogtreecommitdiffstats
path: root/lib/redmine/version.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-12 14:09:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-12 14:09:58 +0000
commit7af1504672d846eb19d98ab42a5eed36aae8cd54 (patch)
treec62cc26e8db6c40f44fddb96ffa824074969cbbe /lib/redmine/version.rb
parent2b797fa82fdd18ec2b3e1c67642278136be68184 (diff)
downloadredmine-7af1504672d846eb19d98ab42a5eed36aae8cd54.tar.gz
redmine-7af1504672d846eb19d98ab42a5eed36aae8cd54.zip
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
Diffstat (limited to 'lib/redmine/version.rb')
-rw-r--r--lib/redmine/version.rb19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/redmine/version.rb b/lib/redmine/version.rb
index fbf6dc603..6b5b61591 100644
--- a/lib/redmine/version.rb
+++ b/lib/redmine/version.rb
@@ -12,26 +12,19 @@ module Redmine
# * trunk: devel
BRANCH = 'devel'
+ # Retrieves the revision from the working copy
def self.revision
- revision = nil
- entries_path = "#{Rails.root}/.svn/entries"
- if File.readable?(entries_path)
+ if File.directory?(File.join(Rails.root, '.svn'))
begin
- f = File.open(entries_path, 'r')
- entries = f.read
- f.close
- 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
+ path = Redmine::Scm::Adapters::AbstractAdapter.shell_quote(Rails.root.to_s)
+ if `svn info --xml #{path}` =~ /revision="(\d+)"/
+ return $1.to_i
end
rescue
# Could not find the current revision
end
end
- revision
+ nil
end
REVISION = self.revision