]> source.dussan.org Git - redmine.git/commitdiff
scm: update adapter initialize() to use path encoding (#2664, #2274).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 24 Feb 2011 05:58:59 +0000 (05:58 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 24 Feb 2011 05:58:59 +0000 (05:58 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4941 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository.rb
lib/redmine/scm/adapters/abstract_adapter.rb
lib/redmine/scm/adapters/cvs_adapter.rb
lib/redmine/scm/adapters/darcs_adapter.rb
lib/redmine/scm/adapters/filesystem_adapter.rb
lib/redmine/scm/adapters/mercurial_adapter.rb

index d1e3d8b2fbab251ebdc8c077b4549d4d6e3cc73d..c9d7d0dbe16c4da5461cd9527bf52ddbcd803416 100644 (file)
@@ -26,12 +26,12 @@ class Repository < ActiveRecord::Base
   
   # Checks if the SCM is enabled when creating a repository
   validate_on_create { |r| r.errors.add(:type, :invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) }
-  
+
   # Removes leading and trailing whitespace
   def url=(arg)
     write_attribute(:url, arg ? arg.to_s.strip : nil)
   end
-  
+
   # Removes leading and trailing whitespace
   def root_url=(arg)
     write_attribute(:root_url, arg ? arg.to_s.strip : nil)
@@ -42,11 +42,12 @@ class Repository < ActiveRecord::Base
   end
 
   def scm
-    @scm ||= self.scm_adapter.new url, root_url, login, password
+    @scm ||= self.scm_adapter.new(url, root_url,
+                                  login, password, path_encoding)
     update_attribute(:root_url, @scm.root_url) if root_url.blank?
     @scm
   end
-  
+
   def scm_name
     self.class.scm_name
   end
@@ -248,7 +249,7 @@ class Repository < ActiveRecord::Base
   end
 
   private
-  
+
   def before_save
     # Strips url and root_url
     url.strip!
index 2bd82f5bca2f96a8698e2cd14ee8e3b0ebeb136e..3f9bc0ef1002bd2758ecef974b599f45df3de437 100644 (file)
@@ -34,14 +34,14 @@ module Redmine
           def client_version
             []
           end
-          
+
           # Returns the version string of the scm client
           # Eg: '1.5.0' or 'Unknown version' if unknown
           def client_version_string
             v = client_version || 'Unknown version'
             v.is_a?(Array) ? v.join('.') : v.to_s
           end
-          
+
           # Returns true if the current client version is above
           # or equals the given one
           # If option is :unknown is set to true, it will return
@@ -63,17 +63,18 @@ module Redmine
           end
         end
 
-        def initialize(url, root_url=nil, login=nil, password=nil)
+        def initialize(url, root_url=nil, login=nil, password=nil,
+                       path_encoding=nil)
           @url = url
           @login = login if login && !login.empty?
           @password = (password || "") if @login
           @root_url = root_url.blank? ? retrieve_root_url : root_url
         end
-        
+
         def adapter_name
           'Abstract'
         end
-        
+
         def supports_cat?
           true
         end
@@ -81,11 +82,11 @@ module Redmine
         def supports_annotate?
           respond_to?('annotate')
         end
-        
+
         def root_url
           @root_url
         end
-      
+
         def url
           @url
         end
index 25d4e420eb0b4d01eab06c14c85ccf6d0b10a42d..762e5c68df0808b1dbb74c1863e706c3dc45c628 100644 (file)
@@ -62,7 +62,8 @@ module Redmine
         #  root_url -> the good old, sometimes damned, CVSROOT
         #  login -> unnecessary
         #  password -> unnecessary too
-        def initialize(url, root_url=nil, login=nil, password=nil)
+        def initialize(url, root_url=nil, login=nil, password=nil,
+                       path_encoding=nil)
           @url = url
           @login = login if login && !login.empty?
           @password = (password || "") if @login
index 279d503f06c8dc33e69c1a88512e521183c79e6b..9b79e653f855ab0bfcd18ae4d752478c457cfddb 100644 (file)
@@ -57,7 +57,8 @@ module Redmine
           end
         end
 
-        def initialize(url, root_url=nil, login=nil, password=nil)
+        def initialize(url, root_url=nil, login=nil, password=nil,
+                       path_encoding=nil)
           @url = url
           @root_url = url
         end
index 477629536271fed29de7a1857382ec1586e92aa3..3f3f131e234218ca5a70b92a05db7d5d98c9ded3 100644 (file)
@@ -32,9 +32,10 @@ module Redmine
           end
         end
 
-        def initialize(url, root_url=nil, login=nil, password=nil)
+        def initialize(url, root_url=nil, login=nil, password=nil,
+                       path_encoding=nil)
           @url = with_trailling_slash(url)
-          @path_encoding = 'UTF-8'
+          @path_encoding = path_encoding || 'UTF-8'
         end
 
         def format_path_ends(path, leading=true, trailling=true)
index 9b12dd38380b2a474d1749bbfb3ef2928f64bcd2..11eb66b641aed76d5fdcaf3ba4d1494c35bd029e 100644 (file)
@@ -81,9 +81,9 @@ module Redmine
           end
         end
 
-        def initialize(url, root_url=nil, login=nil, password=nil)
+        def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil)
           super
-          @path_encoding = 'UTF-8'
+          @path_encoding = path_encoding || 'UTF-8'
         end
 
         def info