scm: cvs: convert author encoding with log encoding setting.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5456 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bebf8247a7
commit
04a22fa757
|
@ -128,7 +128,7 @@ class Repository::Cvs < Repository
|
||||||
fetch_since = latest_changeset ? latest_changeset.committed_on : nil
|
fetch_since = latest_changeset ? latest_changeset.committed_on : nil
|
||||||
transaction do
|
transaction do
|
||||||
tmp_rev_num = 1
|
tmp_rev_num = 1
|
||||||
scm.revisions('', fetch_since, nil, :with_paths => true) do |revision|
|
scm.revisions('', fetch_since, nil, :log_encoding => repo_log_encoding) do |revision|
|
||||||
# only add the change to the database, if it doen't exists. the cvs log
|
# only add the change to the database, if it doen't exists. the cvs log
|
||||||
# is not exclusive at all.
|
# is not exclusive at all.
|
||||||
tmp_time = revision.time.clone
|
tmp_time = revision.time.clone
|
||||||
|
|
|
@ -239,9 +239,10 @@ module Redmine
|
||||||
revision = $1
|
revision = $1
|
||||||
elsif /^date:\s+(\d+.\d+.\d+\s+\d+:\d+:\d+)/ =~ line
|
elsif /^date:\s+(\d+.\d+.\d+\s+\d+:\d+:\d+)/ =~ line
|
||||||
date = Time.parse($1)
|
date = Time.parse($1)
|
||||||
# TODO: This regexp fails in some non UTF-8 chars on Ruby 1.8.
|
line_utf8 = scm_iconv('UTF-8', options[:log_encoding], line)
|
||||||
author = /author: ([^;]+)/.match(line)[1]
|
author_utf8 = /author: ([^;]+)/.match(line_utf8)[1]
|
||||||
file_state = /state: ([^;]+)/.match(line)[1]
|
author = scm_iconv(options[:log_encoding], 'UTF-8', author_utf8)
|
||||||
|
file_state = /state: ([^;]+)/.match(line)[1]
|
||||||
# TODO:
|
# TODO:
|
||||||
# linechanges only available in CVS....
|
# linechanges only available in CVS....
|
||||||
# maybe a feature our SVN implementation.
|
# maybe a feature our SVN implementation.
|
||||||
|
|
|
@ -24,7 +24,7 @@ begin
|
||||||
|
|
||||||
def test_revisions_all
|
def test_revisions_all
|
||||||
cnt = 0
|
cnt = 0
|
||||||
@adapter.revisions('', nil, nil, :with_paths => true) do |revision|
|
@adapter.revisions('', nil, nil, :log_encoding => 'UTF-8') do |revision|
|
||||||
cnt += 1
|
cnt += 1
|
||||||
end
|
end
|
||||||
assert_equal 16, cnt
|
assert_equal 16, cnt
|
||||||
|
@ -33,7 +33,7 @@ begin
|
||||||
def test_revisions_from_rev3
|
def test_revisions_from_rev3
|
||||||
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
|
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
|
||||||
cnt = 0
|
cnt = 0
|
||||||
@adapter.revisions('', rev3_committed_on, nil, :with_paths => true) do |revision|
|
@adapter.revisions('', rev3_committed_on, nil, :log_encoding => 'UTF-8') do |revision|
|
||||||
cnt += 1
|
cnt += 1
|
||||||
end
|
end
|
||||||
assert_equal 4, cnt
|
assert_equal 4, cnt
|
||||||
|
|
Loading…
Reference in New Issue