1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -32,7 +32,11 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||||
32 | @request = ActionController::TestRequest.new |
|
32 | @request = ActionController::TestRequest.new | |
33 | @response = ActionController::TestResponse.new |
|
33 | @response = ActionController::TestResponse.new | |
34 | User.current = nil |
|
34 | User.current = nil | |
35 |
@repository = Repository::Mercurial.create( |
|
35 | @repository = Repository::Mercurial.create( | |
|
36 | :project => Project.find(3), | |||
|
37 | :url => REPOSITORY_PATH, | |||
|
38 | :path_encoding => 'ISO-8859-1' | |||
|
39 | ) | |||
36 | assert @repository |
|
40 | assert @repository | |
37 | @diff_c_support = true |
|
41 | @diff_c_support = true | |
38 | end |
|
42 | end |
@@ -10,10 +10,19 begin | |||||
10 |
|
10 | |||
11 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository' |
|
11 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository' | |
12 |
|
12 | |||
|
13 | CHAR_1_HEX = "\xc3\x9c" | |||
|
14 | ||||
13 | if File.directory?(REPOSITORY_PATH) |
|
15 | if File.directory?(REPOSITORY_PATH) | |
14 | def setup |
|
16 | def setup | |
15 | @adapter = Redmine::Scm::Adapters::MercurialAdapter.new(REPOSITORY_PATH) |
|
17 | @adapter = Redmine::Scm::Adapters::MercurialAdapter.new(REPOSITORY_PATH) | |
16 | @diff_c_support = true |
|
18 | @diff_c_support = true | |
|
19 | ||||
|
20 | @tag_char_1 = "tag-#{CHAR_1_HEX}-00" | |||
|
21 | @branch_char_1 = "branch-#{CHAR_1_HEX}-00" | |||
|
22 | if @tag_char_1.respond_to?(:force_encoding) | |||
|
23 | @tag_char_1.force_encoding('UTF-8') | |||
|
24 | @branch_char_1.force_encoding('UTF-8') | |||
|
25 | end | |||
17 | end |
|
26 | end | |
18 |
|
27 | |||
19 | def test_hgversion |
|
28 | def test_hgversion | |
@@ -49,7 +58,7 begin | |||||
49 | adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo) |
|
58 | adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo) | |
50 | repo_path = adp.info.root_url.gsub(/\\/, "/") |
|
59 | repo_path = adp.info.root_url.gsub(/\\/, "/") | |
51 | assert_equal REPOSITORY_PATH, repo_path |
|
60 | assert_equal REPOSITORY_PATH, repo_path | |
52 |
assert_equal ' |
|
61 | assert_equal '24', adp.info.lastrev.revision | |
53 | assert_equal '4cddb4e45f52',adp.info.lastrev.scmid |
|
62 | assert_equal '4cddb4e45f52',adp.info.lastrev.scmid | |
54 | end |
|
63 | end | |
55 | end |
|
64 | end | |
@@ -97,7 +106,7 begin | |||||
97 |
|
106 | |||
98 | def test_diff_made_by_revision |
|
107 | def test_diff_made_by_revision | |
99 | if @diff_c_support |
|
108 | if @diff_c_support | |
100 |
[ |
|
109 | [24, '24', '4cddb4e45f52'].each do |r1| | |
101 | diff1 = @adapter.diff(nil, r1) |
|
110 | diff1 = @adapter.diff(nil, r1) | |
102 | assert_equal 5, diff1.size |
|
111 | assert_equal 5, diff1.size | |
103 | buf = diff1[4].gsub(/\r\n|\r|\n/, "") |
|
112 | buf = diff1[4].gsub(/\r\n|\r|\n/, "") | |
@@ -219,24 +228,32 begin | |||||
219 | end |
|
228 | end | |
220 |
|
229 | |||
221 | def test_tags |
|
230 | def test_tags | |
222 | assert_equal ['tag_test.00', 'tag-init-revision'], @adapter.tags |
|
231 | assert_equal [@tag_char_1, 'tag_test.00', 'tag-init-revision'], @adapter.tags | |
223 | end |
|
232 | end | |
224 |
|
233 | |||
225 | def test_tagmap |
|
234 | def test_tagmap | |
226 | tm = { 'tag_test.00' => '6987191f453a', |
|
235 | tm = { | |
227 | 'tag-init-revision' => '0885933ad4f6' } |
|
236 | @tag_char_1 => 'adf805632193', | |
|
237 | 'tag_test.00' => '6987191f453a', | |||
|
238 | 'tag-init-revision' => '0885933ad4f6', | |||
|
239 | } | |||
228 | assert_equal tm, @adapter.tagmap |
|
240 | assert_equal tm, @adapter.tagmap | |
229 | end |
|
241 | end | |
230 |
|
242 | |||
231 | def test_branches |
|
243 | def test_branches | |
232 |
assert_equal ['default', |
|
244 | assert_equal ['default', @branch_char_1, | |
233 | @adapter.branches |
|
245 | 'test_branch.latin-1', 'branch (1)[2]&,%.-3_4', 'test-branch-00'], | |
|
246 | @adapter.branches | |||
234 | end |
|
247 | end | |
235 |
|
248 | |||
236 | def test_branchmap |
|
249 | def test_branchmap | |
237 | bm = { 'default' => '4cddb4e45f52', |
|
250 | bm = { | |
238 | 'branch (1)[2]&,%.-3_4' => '933ca60293d7', |
|
251 | 'default' => '4cddb4e45f52', | |
239 | 'test-branch-00' => '3a330eb32958' } |
|
252 | @branch_char_1 => 'c8d3e4887474', | |
|
253 | 'test_branch.latin-1' => 'c2ffe7da686a', | |||
|
254 | 'branch (1)[2]&,%.-3_4' => '933ca60293d7', | |||
|
255 | 'test-branch-00' => '3a330eb32958' | |||
|
256 | } | |||
240 | assert_equal bm, @adapter.branchmap |
|
257 | assert_equal bm, @adapter.branchmap | |
241 | end |
|
258 | end | |
242 |
|
259 |
@@ -25,7 +25,11 class RepositoryMercurialTest < ActiveSupport::TestCase | |||||
25 |
|
25 | |||
26 | def setup |
|
26 | def setup | |
27 | @project = Project.find(3) |
|
27 | @project = Project.find(3) | |
28 |
@repository = Repository::Mercurial.create( |
|
28 | @repository = Repository::Mercurial.create( | |
|
29 | :project => @project, | |||
|
30 | :url => REPOSITORY_PATH, | |||
|
31 | :path_encoding => 'ISO-8859-1' | |||
|
32 | ) | |||
29 | assert @repository |
|
33 | assert @repository | |
30 | end |
|
34 | end | |
31 |
|
35 | |||
@@ -33,8 +37,8 class RepositoryMercurialTest < ActiveSupport::TestCase | |||||
33 | def test_fetch_changesets_from_scratch |
|
37 | def test_fetch_changesets_from_scratch | |
34 | @repository.fetch_changesets |
|
38 | @repository.fetch_changesets | |
35 | @repository.reload |
|
39 | @repository.reload | |
36 |
assert_equal |
|
40 | assert_equal 25, @repository.changesets.count | |
37 |
assert_equal 2 |
|
41 | assert_equal 32, @repository.changes.count | |
38 | assert_equal "Initial import.\nThe repository contains 3 files.", |
|
42 | assert_equal "Initial import.\nThe repository contains 3 files.", | |
39 | @repository.changesets.find_by_revision('0').comments |
|
43 | @repository.changesets.find_by_revision('0').comments | |
40 | end |
|
44 | end | |
@@ -47,7 +51,7 class RepositoryMercurialTest < ActiveSupport::TestCase | |||||
47 | assert_equal 3, @repository.changesets.count |
|
51 | assert_equal 3, @repository.changesets.count | |
48 |
|
52 | |||
49 | @repository.fetch_changesets |
|
53 | @repository.fetch_changesets | |
50 |
assert_equal |
|
54 | assert_equal 25, @repository.changesets.count | |
51 | end |
|
55 | end | |
52 |
|
56 | |||
53 | def test_isodatesec |
|
57 | def test_isodatesec | |
@@ -170,7 +174,7 class RepositoryMercurialTest < ActiveSupport::TestCase | |||||
170 | @repository.fetch_changesets |
|
174 | @repository.fetch_changesets | |
171 | @repository.reload |
|
175 | @repository.reload | |
172 | changesets = @repository.latest_changesets('README', nil) |
|
176 | changesets = @repository.latest_changesets('README', nil) | |
173 | assert_equal %w|8 6 1 0|, changesets.collect(&:revision) |
|
177 | assert_equal %w|17 8 6 1 0|, changesets.collect(&:revision) | |
174 |
|
178 | |||
175 | path = 'sql_escape/percent%dir/percent%file1.txt' |
|
179 | path = 'sql_escape/percent%dir/percent%file1.txt' | |
176 | changesets = @repository.latest_changesets(path, nil) |
|
180 | changesets = @repository.latest_changesets(path, nil) |
General Comments 0
You need to be logged in to leave comments.
Login now