Commit 486ecc66 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Fixed: non-ASCII subversion path can't be displayed (patch #1993 by Chaoqun Zou).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2004 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 5166213f
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
require 'redmine/scm/adapters/abstract_adapter' require 'redmine/scm/adapters/abstract_adapter'
require 'rexml/document' require 'rexml/document'
require 'uri'
module Redmine module Redmine
module Scm module Scm
...@@ -76,7 +77,7 @@ module Redmine ...@@ -76,7 +77,7 @@ module Redmine
path ||= '' path ||= ''
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
entries = Entries.new entries = Entries.new
cmd = "#{SVN_BIN} list --xml #{target(path)}@#{identifier}" cmd = "#{SVN_BIN} list --xml #{target(URI.escape(path))}@#{identifier}"
cmd << credentials_string cmd << credentials_string
shellout(cmd) do |io| shellout(cmd) do |io|
output = io.read output = io.read
...@@ -86,7 +87,7 @@ module Redmine ...@@ -86,7 +87,7 @@ module Redmine
# Skip directory if there is no commit date (usually that # Skip directory if there is no commit date (usually that
# means that we don't have read access to it) # means that we don't have read access to it)
next if entry.attributes['kind'] == 'dir' && entry.elements['commit'].elements['date'].nil? next if entry.attributes['kind'] == 'dir' && entry.elements['commit'].elements['date'].nil?
entries << Entry.new({:name => entry.elements['name'].text, entries << Entry.new({:name => URI.unescape(entry.elements['name'].text),
:path => ((path.empty? ? "" : "#{path}/") + entry.elements['name'].text), :path => ((path.empty? ? "" : "#{path}/") + entry.elements['name'].text),
:kind => entry.attributes['kind'], :kind => entry.attributes['kind'],
:size => (entry.elements['size'] and entry.elements['size'].text).to_i, :size => (entry.elements['size'] and entry.elements['size'].text).to_i,
...@@ -112,7 +113,7 @@ module Redmine ...@@ -112,7 +113,7 @@ module Redmine
return nil unless self.class.client_version_above?([1, 5, 0]) return nil unless self.class.client_version_above?([1, 5, 0])
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
cmd = "#{SVN_BIN} proplist --verbose --xml #{target(path)}@#{identifier}" cmd = "#{SVN_BIN} proplist --verbose --xml #{target(URI.escape(path))}@#{identifier}"
cmd << credentials_string cmd << credentials_string
properties = {} properties = {}
shellout(cmd) do |io| shellout(cmd) do |io|
...@@ -137,7 +138,7 @@ module Redmine ...@@ -137,7 +138,7 @@ module Redmine
cmd = "#{SVN_BIN} log --xml -r #{identifier_from}:#{identifier_to}" cmd = "#{SVN_BIN} log --xml -r #{identifier_from}:#{identifier_to}"
cmd << credentials_string cmd << credentials_string
cmd << " --verbose " if options[:with_paths] cmd << " --verbose " if options[:with_paths]
cmd << ' ' + target(path) cmd << ' ' + target(URI.escape(path))
shellout(cmd) do |io| shellout(cmd) do |io|
begin begin
doc = REXML::Document.new(io) doc = REXML::Document.new(io)
...@@ -174,7 +175,7 @@ module Redmine ...@@ -174,7 +175,7 @@ module Redmine
cmd = "#{SVN_BIN} diff -r " cmd = "#{SVN_BIN} diff -r "
cmd << "#{identifier_to}:" cmd << "#{identifier_to}:"
cmd << "#{identifier_from}" cmd << "#{identifier_from}"
cmd << " #{target(path)}@#{identifier_from}" cmd << " #{target(URI.escape(path))}@#{identifier_from}"
cmd << credentials_string cmd << credentials_string
diff = [] diff = []
shellout(cmd) do |io| shellout(cmd) do |io|
...@@ -188,7 +189,7 @@ module Redmine ...@@ -188,7 +189,7 @@ module Redmine
def cat(path, identifier=nil) def cat(path, identifier=nil)
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
cmd = "#{SVN_BIN} cat #{target(path)}@#{identifier}" cmd = "#{SVN_BIN} cat #{target(URI.escape(path))}@#{identifier}"
cmd << credentials_string cmd << credentials_string
cat = nil cat = nil
shellout(cmd) do |io| shellout(cmd) do |io|
...@@ -201,7 +202,7 @@ module Redmine ...@@ -201,7 +202,7 @@ module Redmine
def annotate(path, identifier=nil) def annotate(path, identifier=nil)
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
cmd = "#{SVN_BIN} blame #{target(path)}@#{identifier}" cmd = "#{SVN_BIN} blame #{target(URI.escape(path))}@#{identifier}"
cmd << credentials_string cmd << credentials_string
blame = Annotate.new blame = Annotate.new
shellout(cmd) do |io| shellout(cmd) do |io|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment