@@ -12,26 +12,19 module Redmine | |||
|
12 | 12 | # * trunk: devel |
|
13 | 13 | BRANCH = 'devel' |
|
14 | 14 | |
|
15 | # Retrieves the revision from the working copy | |
|
15 | 16 | def self.revision |
|
16 | revision = nil | |
|
17 | entries_path = "#{Rails.root}/.svn/entries" | |
|
18 | if File.readable?(entries_path) | |
|
17 | if File.directory?(File.join(Rails.root, '.svn')) | |
|
19 | 18 | begin |
|
20 | f = File.open(entries_path, 'r') | |
|
21 | entries = f.read | |
|
22 | f.close | |
|
23 | if entries.match(%r{^\d+}) | |
|
24 | revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s}) | |
|
25 | else | |
|
26 | xml = REXML::Document.new(entries) | |
|
27 | revision = | |
|
28 | xml.elements['wc-entries'].elements[1].attributes['revision'].to_i | |
|
19 | path = Redmine::Scm::Adapters::AbstractAdapter.shell_quote(Rails.root.to_s) | |
|
20 | if `svn info --xml #{path}` =~ /revision="(\d+)"/ | |
|
21 | return $1.to_i | |
|
29 | 22 | end |
|
30 | 23 | rescue |
|
31 | 24 | # Could not find the current revision |
|
32 | 25 | end |
|
33 | 26 | end |
|
34 |
|
|
|
27 | nil | |
|
35 | 28 | end |
|
36 | 29 | |
|
37 | 30 | REVISION = self.revision |
General Comments 0
You need to be logged in to leave comments.
Login now