summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm/adapters/mercurial_adapter.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-02-22 08:47:19 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-02-22 08:47:19 +0000
commitc37f638912fbc1ce8b1432a8878745ad7caaabaf (patch)
treebb6583e2ac844e3c1985d57694ab4dbdf11b46a6 /lib/redmine/scm/adapters/mercurial_adapter.rb
parentd43284ba047606b86d03a4a0b6c34ab252b73629 (diff)
downloadredmine-c37f638912fbc1ce8b1432a8878745ad7caaabaf.tar.gz
redmine-c37f638912fbc1ce8b1432a8878745ad7caaabaf.zip
scm: mercurial: log and entries path encoding support in adapter (#2664).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4923 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm/adapters/mercurial_adapter.rb')
-rw-r--r--lib/redmine/scm/adapters/mercurial_adapter.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index e8c5fe883..9021e1d92 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -129,8 +129,9 @@ module Redmine
private :summary
def entries(path=nil, identifier=nil)
+ p1 = scm_iconv(@path_encoding, 'UTF-8', path)
manifest = hg('rhmanifest', '-r', hgrev(identifier),
- CGI.escape(without_leading_slash(path.to_s))) do |io|
+ CGI.escape(without_leading_slash(p1.to_s))) do |io|
begin
ActiveSupport::XmlMini.parse(io.read)['rhmanifest']['repository']['manifest']
rescue
@@ -140,13 +141,13 @@ module Redmine
entries = Entries.new
as_ary(manifest['dir']).each do |e|
- n = CGI.unescape(e['name'])
+ n = scm_iconv('UTF-8', @path_encoding, CGI.unescape(e['name']))
p = "#{path_prefix}#{n}"
entries << Entry.new(:name => n, :path => p, :kind => 'dir')
end
as_ary(manifest['file']).each do |e|
- n = CGI.unescape(e['name'])
+ n = scm_iconv('UTF-8', @path_encoding, CGI.unescape(e['name']))
p = "#{path_prefix}#{n}"
lr = Revision.new(:revision => e['revision'], :scmid => e['node'],
:identifier => e['node'],
@@ -188,7 +189,7 @@ module Redmine
cpmap = Hash[*cpalist.flatten]
paths = as_ary(le['paths']['path']).map do |e|
- p = CGI.unescape(e['__content__'])
+ p = scm_iconv('UTF-8', @path_encoding, CGI.unescape(e['__content__']) )
{:action => e['action'], :path => with_leading_slash(p),
:from_path => (cpmap.member?(p) ? with_leading_slash(cpmap[p]) : nil),
:from_revision => (cpmap.member?(p) ? le['revision'] : nil)}
@@ -211,7 +212,10 @@ module Redmine
else
hg_args << '-c' << hgrev(identifier_from)
end
- hg_args << CGI.escape(hgtarget(path)) unless path.blank?
+ unless path.blank?
+ p = scm_iconv(@path_encoding, 'UTF-8', path)
+ hg_args << CGI.escape(hgtarget(p))
+ end
diff = []
hg *hg_args do |io|
io.each_line do |line|