Mercurial > hg > soundsoftware-site
comparison test/unit/repository_git_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
18 require File.expand_path('../../test_helper', __FILE__) | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class RepositoryGitTest < ActiveSupport::TestCase | 20 class RepositoryGitTest < ActiveSupport::TestCase |
21 fixtures :projects, :repositories, :enabled_modules, :users, :roles | 21 fixtures :projects, :repositories, :enabled_modules, :users, :roles |
22 | 22 |
23 include Redmine::I18n | |
24 | |
23 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s | 25 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s |
24 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? | 26 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
25 | 27 |
26 NUM_REV = 21 | 28 NUM_REV = 28 |
29 NUM_HEAD = 6 | |
27 | 30 |
28 FELIX_HEX = "Felix Sch\xC3\xA4fer" | 31 FELIX_HEX = "Felix Sch\xC3\xA4fer" |
29 CHAR_1_HEX = "\xc3\x9c" | 32 CHAR_1_HEX = "\xc3\x9c" |
30 | |
31 ## Ruby uses ANSI api to fork a process on Windows. | |
32 ## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem | |
33 ## and these are incompatible with ASCII. | |
34 # WINDOWS_PASS = Redmine::Platform.mswin? | |
35 WINDOWS_PASS = false | |
36 | 33 |
37 ## Git, Mercurial and CVS path encodings are binary. | 34 ## Git, Mercurial and CVS path encodings are binary. |
38 ## Subversion supports URL encoding for path. | 35 ## Subversion supports URL encoding for path. |
39 ## Redmine Mercurial adapter and extension use URL encoding. | 36 ## Redmine Mercurial adapter and extension use URL encoding. |
40 ## Git accepts only binary path in command line parameter. | 37 ## Git accepts only binary path in command line parameter. |
41 ## So, there is no way to use binary command line parameter in JRuby. | 38 ## So, there is no way to use binary command line parameter in JRuby. |
42 JRUBY_SKIP = (RUBY_PLATFORM == 'java') | 39 JRUBY_SKIP = (RUBY_PLATFORM == 'java') |
43 JRUBY_SKIP_STR = "TODO: This test fails in JRuby" | 40 JRUBY_SKIP_STR = "TODO: This test fails in JRuby" |
44 | 41 |
42 def setup | |
43 @project = Project.find(3) | |
44 @repository = Repository::Git.create( | |
45 :project => @project, | |
46 :url => REPOSITORY_PATH, | |
47 :path_encoding => 'ISO-8859-1' | |
48 ) | |
49 assert @repository | |
50 @char_1 = CHAR_1_HEX.dup | |
51 if @char_1.respond_to?(:force_encoding) | |
52 @char_1.force_encoding('UTF-8') | |
53 end | |
54 end | |
55 | |
56 def test_blank_path_to_repository_error_message | |
57 set_language_if_valid 'en' | |
58 repo = Repository::Git.new( | |
59 :project => @project, | |
60 :identifier => 'test' | |
61 ) | |
62 assert !repo.save | |
63 assert_include "Path to repository can't be blank", | |
64 repo.errors.full_messages | |
65 end | |
66 | |
67 def test_blank_path_to_repository_error_message_fr | |
68 set_language_if_valid 'fr' | |
69 str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)" | |
70 str.force_encoding('UTF-8') if str.respond_to?(:force_encoding) | |
71 repo = Repository::Git.new( | |
72 :project => @project, | |
73 :url => "", | |
74 :identifier => 'test', | |
75 :path_encoding => '' | |
76 ) | |
77 assert !repo.save | |
78 assert_include str, repo.errors.full_messages | |
79 end | |
80 | |
45 if File.directory?(REPOSITORY_PATH) | 81 if File.directory?(REPOSITORY_PATH) |
46 def setup | 82 ## Ruby uses ANSI api to fork a process on Windows. |
83 ## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem | |
84 ## and these are incompatible with ASCII. | |
85 ## Git for Windows (msysGit) changed internal API from ANSI to Unicode in 1.7.10 | |
86 ## http://code.google.com/p/msysgit/issues/detail?id=80 | |
87 ## So, Latin-1 path tests fail on Japanese Windows | |
88 WINDOWS_PASS = (Redmine::Platform.mswin? && | |
89 Redmine::Scm::Adapters::GitAdapter.client_version_above?([1, 7, 10])) | |
90 WINDOWS_SKIP_STR = "TODO: This test fails in Git for Windows above 1.7.10" | |
91 | |
92 def test_scm_available | |
47 klass = Repository::Git | 93 klass = Repository::Git |
48 assert_equal "Git", klass.scm_name | 94 assert_equal "Git", klass.scm_name |
49 assert klass.scm_adapter_class | 95 assert klass.scm_adapter_class |
50 assert_not_equal "", klass.scm_command | 96 assert_not_equal "", klass.scm_command |
51 assert_equal true, klass.scm_available | 97 assert_equal true, klass.scm_available |
52 | 98 end |
53 @project = Project.find(3) | 99 |
54 @repository = Repository::Git.create( | 100 def test_entries |
55 :project => @project, | 101 entries = @repository.entries |
56 :url => REPOSITORY_PATH, | 102 assert_kind_of Redmine::Scm::Adapters::Entries, entries |
57 :path_encoding => 'ISO-8859-1' | |
58 ) | |
59 assert @repository | |
60 @char_1 = CHAR_1_HEX.dup | |
61 if @char_1.respond_to?(:force_encoding) | |
62 @char_1.force_encoding('UTF-8') | |
63 end | |
64 end | 103 end |
65 | 104 |
66 def test_fetch_changesets_from_scratch | 105 def test_fetch_changesets_from_scratch |
67 assert_nil @repository.extra_info | 106 assert_nil @repository.extra_info |
68 | 107 |
69 assert_equal 0, @repository.changesets.count | 108 assert_equal 0, @repository.changesets.count |
70 @repository.fetch_changesets | 109 @repository.fetch_changesets |
71 @project.reload | 110 @project.reload |
72 | 111 |
73 assert_equal NUM_REV, @repository.changesets.count | 112 assert_equal NUM_REV, @repository.changesets.count |
74 assert_equal 33, @repository.changes.count | 113 assert_equal 39, @repository.filechanges.count |
75 | 114 |
76 commit = @repository.changesets.find(:first, :order => 'committed_on ASC') | 115 commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518") |
116 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid | |
77 assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments | 117 assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments |
78 assert_equal "jsmith <jsmith@foo.bar>", commit.committer | 118 assert_equal "jsmith <jsmith@foo.bar>", commit.committer |
79 assert_equal User.find_by_login('jsmith'), commit.user | 119 assert_equal User.find_by_login('jsmith'), commit.user |
80 # TODO: add a commit with commit time <> author time to the test repository | 120 # TODO: add a commit with commit time <> author time to the test repository |
81 assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on | 121 assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on |
82 assert_equal "2007-12-14".to_date, commit.commit_date | 122 assert_equal "2007-12-14".to_date, commit.commit_date |
83 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.revision | 123 assert_equal 3, commit.filechanges.count |
84 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid | 124 change = commit.filechanges.sort_by(&:path).first |
85 assert_equal 3, commit.changes.count | |
86 change = commit.changes.sort_by(&:path).first | |
87 assert_equal "README", change.path | 125 assert_equal "README", change.path |
126 assert_equal nil, change.from_path | |
88 assert_equal "A", change.action | 127 assert_equal "A", change.action |
89 | 128 |
90 assert_equal 4, @repository.extra_info["branches"].size | 129 assert_equal NUM_HEAD, @repository.extra_info["heads"].size |
91 end | 130 end |
92 | 131 |
93 def test_fetch_changesets_incremental | 132 def test_fetch_changesets_incremental |
94 assert_equal 0, @repository.changesets.count | 133 assert_equal 0, @repository.changesets.count |
95 @repository.fetch_changesets | 134 @repository.fetch_changesets |
96 @project.reload | 135 @project.reload |
97 assert_equal NUM_REV, @repository.changesets.count | 136 assert_equal NUM_REV, @repository.changesets.count |
98 assert_equal 33, @repository.changes.count | 137 extra_info_heads = @repository.extra_info["heads"].dup |
99 extra_info_db = @repository.extra_info["branches"] | 138 assert_equal NUM_HEAD, extra_info_heads.size |
100 assert_equal 4, extra_info_db.size | 139 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" } |
101 assert_equal "1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127", | 140 assert_equal 4, extra_info_heads.size |
102 extra_info_db["latin-1-path-encoding"]["last_scmid"] | |
103 assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", | |
104 extra_info_db["master"]["last_scmid"] | |
105 | 141 |
106 del_revs = [ | 142 del_revs = [ |
107 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", | 143 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
108 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", | 144 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", |
109 "4f26664364207fa8b1af9f8722647ab2d4ac5d43", | 145 "4f26664364207fa8b1af9f8722647ab2d4ac5d43", |
114 @repository.changesets.each do |rev| | 150 @repository.changesets.each do |rev| |
115 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s } | 151 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s } |
116 end | 152 end |
117 @project.reload | 153 @project.reload |
118 cs1 = @repository.changesets | 154 cs1 = @repository.changesets |
119 assert_equal 15, cs1.count | 155 assert_equal NUM_REV - 6, cs1.count |
120 h = @repository.extra_info.dup | 156 extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" |
121 h["branches"]["master"]["last_scmid"] = | 157 h = {} |
122 "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" | 158 h["heads"] = extra_info_heads |
123 @repository.merge_extra_info(h) | 159 @repository.merge_extra_info(h) |
124 @repository.save | 160 @repository.save |
125 @project.reload | 161 @project.reload |
126 extra_info_db_1 = @repository.extra_info["branches"] | 162 assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8") |
127 assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", | 163 @repository.fetch_changesets |
128 extra_info_db_1["master"]["last_scmid"] | 164 @project.reload |
129 | 165 assert_equal NUM_REV, @repository.changesets.count |
130 @repository.fetch_changesets | 166 assert_equal NUM_HEAD, @repository.extra_info["heads"].size |
131 @project.reload | 167 assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c") |
132 assert_equal NUM_REV, @repository.changesets.count | 168 end |
133 end | 169 |
134 | 170 def test_fetch_changesets_history_editing |
135 def test_fetch_changesets_invalid_rev | 171 assert_equal 0, @repository.changesets.count |
136 assert_equal 0, @repository.changesets.count | 172 @repository.fetch_changesets |
137 @repository.fetch_changesets | 173 @project.reload |
138 @project.reload | 174 assert_equal NUM_REV, @repository.changesets.count |
139 assert_equal NUM_REV, @repository.changesets.count | 175 extra_info_heads = @repository.extra_info["heads"].dup |
140 extra_info_db = @repository.extra_info["branches"] | 176 assert_equal NUM_HEAD, extra_info_heads.size |
141 assert_equal 4, extra_info_db.size | 177 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" } |
142 assert_equal "1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127", | 178 assert_equal 4, extra_info_heads.size |
143 extra_info_db["latin-1-path-encoding"]["last_scmid"] | |
144 assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", | |
145 extra_info_db["master"]["last_scmid"] | |
146 | 179 |
147 del_revs = [ | 180 del_revs = [ |
148 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", | 181 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
149 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", | 182 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", |
150 "4f26664364207fa8b1af9f8722647ab2d4ac5d43", | 183 "4f26664364207fa8b1af9f8722647ab2d4ac5d43", |
154 ] | 187 ] |
155 @repository.changesets.each do |rev| | 188 @repository.changesets.each do |rev| |
156 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s } | 189 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s } |
157 end | 190 end |
158 @project.reload | 191 @project.reload |
159 cs1 = @repository.changesets | 192 assert_equal NUM_REV - 6, @repository.changesets.count |
160 assert_equal 15, cs1.count | 193 |
161 h = @repository.extra_info.dup | 194 c = Changeset.new(:repository => @repository, |
162 h["branches"]["master"]["last_scmid"] = | 195 :committed_on => Time.now, |
163 "abcd1234efgh" | 196 :revision => "abcd1234efgh", |
197 :scmid => "abcd1234efgh", | |
198 :comments => 'test') | |
199 assert c.save | |
200 @project.reload | |
201 assert_equal NUM_REV - 5, @repository.changesets.count | |
202 | |
203 extra_info_heads << "1234abcd5678" | |
204 h = {} | |
205 h["heads"] = extra_info_heads | |
164 @repository.merge_extra_info(h) | 206 @repository.merge_extra_info(h) |
165 @repository.save | 207 @repository.save |
166 @project.reload | 208 @project.reload |
167 extra_info_db_1 = @repository.extra_info["branches"] | 209 h1 = @repository.extra_info["heads"].dup |
168 assert_equal "abcd1234efgh", | 210 assert h1.index("1234abcd5678") |
169 extra_info_db_1["master"]["last_scmid"] | 211 assert_equal 5, h1.size |
170 | 212 |
171 @repository.fetch_changesets | 213 @repository.fetch_changesets |
172 @project.reload | 214 @project.reload |
173 assert_equal 15, @repository.changesets.count | 215 assert_equal NUM_REV - 5, @repository.changesets.count |
216 h2 = @repository.extra_info["heads"].dup | |
217 assert_equal h1, h2 | |
218 end | |
219 | |
220 def test_keep_extra_report_last_commit_in_clear_changesets | |
221 assert_nil @repository.extra_info | |
222 h = {} | |
223 h["extra_report_last_commit"] = "1" | |
224 @repository.merge_extra_info(h) | |
225 @repository.save | |
226 @project.reload | |
227 | |
228 assert_equal 0, @repository.changesets.count | |
229 @repository.fetch_changesets | |
230 @project.reload | |
231 | |
232 assert_equal NUM_REV, @repository.changesets.count | |
233 @repository.send(:clear_changesets) | |
234 assert_equal 1, @repository.extra_info.size | |
235 assert_equal "1", @repository.extra_info["extra_report_last_commit"] | |
236 end | |
237 | |
238 def test_refetch_after_clear_changesets | |
239 assert_nil @repository.extra_info | |
240 assert_equal 0, @repository.changesets.count | |
241 @repository.fetch_changesets | |
242 @project.reload | |
243 assert_equal NUM_REV, @repository.changesets.count | |
244 | |
245 @repository.send(:clear_changesets) | |
246 @project.reload | |
247 assert_equal 0, @repository.changesets.count | |
248 | |
249 @repository.fetch_changesets | |
250 @project.reload | |
251 assert_equal NUM_REV, @repository.changesets.count | |
174 end | 252 end |
175 | 253 |
176 def test_parents | 254 def test_parents |
177 assert_equal 0, @repository.changesets.count | 255 assert_equal 0, @repository.changesets.count |
178 @repository.fetch_changesets | 256 @repository.fetch_changesets |
204 assert_equal 0, @repository.changesets.count | 282 assert_equal 0, @repository.changesets.count |
205 @repository.fetch_changesets | 283 @repository.fetch_changesets |
206 @project.reload | 284 @project.reload |
207 assert_equal NUM_REV, @repository.changesets.count | 285 assert_equal NUM_REV, @repository.changesets.count |
208 assert_not_nil @repository.extra_info | 286 assert_not_nil @repository.extra_info |
209 @repository.write_attribute(:extra_info, nil) | 287 h = {} |
288 h["heads"] = [] | |
289 h["branches"] = {} | |
290 h["db_consistent"] = {} | |
291 @repository.merge_extra_info(h) | |
210 @repository.save | 292 @repository.save |
211 assert_nil @repository.extra_info | |
212 assert_equal NUM_REV, @repository.changesets.count | 293 assert_equal NUM_REV, @repository.changesets.count |
213 @repository.fetch_changesets | 294 @repository.fetch_changesets |
214 @project.reload | 295 @project.reload |
215 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] | 296 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] |
216 | 297 |
298 extra_info_heads = @repository.extra_info["heads"].dup | |
299 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" } | |
217 del_revs = [ | 300 del_revs = [ |
218 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", | 301 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
219 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", | 302 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", |
220 "4f26664364207fa8b1af9f8722647ab2d4ac5d43", | 303 "4f26664364207fa8b1af9f8722647ab2d4ac5d43", |
221 "deff712f05a90d96edbd70facc47d944be5897e3", | 304 "deff712f05a90d96edbd70facc47d944be5897e3", |
225 @repository.changesets.each do |rev| | 308 @repository.changesets.each do |rev| |
226 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s } | 309 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s } |
227 end | 310 end |
228 @project.reload | 311 @project.reload |
229 cs1 = @repository.changesets | 312 cs1 = @repository.changesets |
230 assert_equal 15, cs1.count | 313 assert_equal NUM_REV - 6, cs1.count |
231 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] | 314 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] |
232 h = @repository.extra_info.dup | 315 |
233 h["branches"]["master"]["last_scmid"] = | 316 extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" |
234 "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" | 317 h = {} |
318 h["heads"] = extra_info_heads | |
235 @repository.merge_extra_info(h) | 319 @repository.merge_extra_info(h) |
236 @repository.save | 320 @repository.save |
237 @project.reload | 321 @project.reload |
238 extra_info_db_1 = @repository.extra_info["branches"] | 322 assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8") |
239 assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", | 323 @repository.fetch_changesets |
240 extra_info_db_1["master"]["last_scmid"] | 324 @project.reload |
241 | 325 assert_equal NUM_REV, @repository.changesets.count |
242 @repository.fetch_changesets | 326 assert_equal NUM_HEAD, @repository.extra_info["heads"].size |
243 assert_equal NUM_REV, @repository.changesets.count | 327 |
244 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] | 328 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] |
245 end | 329 end |
246 | 330 |
331 def test_heads_from_branches_hash | |
332 assert_nil @repository.extra_info | |
333 assert_equal 0, @repository.changesets.count | |
334 assert_equal [], @repository.heads_from_branches_hash | |
335 h = {} | |
336 h["branches"] = {} | |
337 h["branches"]["test1"] = {} | |
338 h["branches"]["test1"]["last_scmid"] = "1234abcd" | |
339 h["branches"]["test2"] = {} | |
340 h["branches"]["test2"]["last_scmid"] = "abcd1234" | |
341 @repository.merge_extra_info(h) | |
342 @repository.save | |
343 @project.reload | |
344 assert_equal ["1234abcd", "abcd1234"], @repository.heads_from_branches_hash.sort | |
345 end | |
346 | |
247 def test_latest_changesets | 347 def test_latest_changesets |
248 assert_equal 0, @repository.changesets.count | 348 assert_equal 0, @repository.changesets.count |
249 @repository.fetch_changesets | 349 @repository.fetch_changesets |
250 @project.reload | 350 @project.reload |
251 assert_equal NUM_REV, @repository.changesets.count | 351 assert_equal NUM_REV, @repository.changesets.count |
252 # with limit | 352 # with limit |
253 changesets = @repository.latest_changesets('', nil, 2) | 353 changesets = @repository.latest_changesets('', 'master', 2) |
254 assert_equal 2, changesets.size | 354 assert_equal 2, changesets.size |
255 | 355 |
256 # with path | 356 # with path |
257 changesets = @repository.latest_changesets('images', nil) | 357 changesets = @repository.latest_changesets('images', 'master') |
258 assert_equal [ | 358 assert_equal [ |
259 'deff712f05a90d96edbd70facc47d944be5897e3', | 359 'deff712f05a90d96edbd70facc47d944be5897e3', |
260 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', | 360 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
261 '7234cb2750b63f47bff735edc50a1c0a433c2518', | 361 '7234cb2750b63f47bff735edc50a1c0a433c2518', |
262 ], changesets.collect(&:revision) | 362 ], changesets.collect(&:revision) |
341 assert_equal [ | 441 assert_equal [ |
342 '713f4944648826f558cf548222f813dabe7cbb04', | 442 '713f4944648826f558cf548222f813dabe7cbb04', |
343 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', | 443 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', |
344 ], changesets.collect(&:revision) | 444 ], changesets.collect(&:revision) |
345 | 445 |
346 if JRUBY_SKIP | 446 if WINDOWS_PASS |
447 puts WINDOWS_SKIP_STR | |
448 elsif JRUBY_SKIP | |
347 puts JRUBY_SKIP_STR | 449 puts JRUBY_SKIP_STR |
348 else | 450 else |
349 # latin-1 encoding path | 451 # latin-1 encoding path |
350 changesets = @repository.latest_changesets( | 452 changesets = @repository.latest_changesets( |
351 "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89') | 453 "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89') |
362 end | 464 end |
363 end | 465 end |
364 | 466 |
365 def test_latest_changesets_latin_1_dir | 467 def test_latest_changesets_latin_1_dir |
366 if WINDOWS_PASS | 468 if WINDOWS_PASS |
367 # | 469 puts WINDOWS_SKIP_STR |
368 elsif JRUBY_SKIP | 470 elsif JRUBY_SKIP |
369 puts JRUBY_SKIP_STR | 471 puts JRUBY_SKIP_STR |
370 else | 472 else |
371 assert_equal 0, @repository.changesets.count | 473 assert_equal 0, @repository.changesets.count |
372 @repository.fetch_changesets | 474 @repository.fetch_changesets |
461 def test_previous_nil | 563 def test_previous_nil |
462 assert_equal 0, @repository.changesets.count | 564 assert_equal 0, @repository.changesets.count |
463 @repository.fetch_changesets | 565 @repository.fetch_changesets |
464 @project.reload | 566 @project.reload |
465 assert_equal NUM_REV, @repository.changesets.count | 567 assert_equal NUM_REV, @repository.changesets.count |
466 %w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb2|.each do |r1| | 568 %w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb275|.each do |r1| |
467 changeset = @repository.find_changeset_by_name(r1) | 569 changeset = @repository.find_changeset_by_name(r1) |
468 assert_nil changeset.previous | 570 assert_nil changeset.previous |
469 end | 571 end |
470 end | 572 end |
471 | 573 |
485 def test_next_nil | 587 def test_next_nil |
486 assert_equal 0, @repository.changesets.count | 588 assert_equal 0, @repository.changesets.count |
487 @repository.fetch_changesets | 589 @repository.fetch_changesets |
488 @project.reload | 590 @project.reload |
489 assert_equal NUM_REV, @repository.changesets.count | 591 assert_equal NUM_REV, @repository.changesets.count |
490 %w|67e7792ce20ccae2e4bb73eed09bb397819c8834 67e7792ce20cca|.each do |r1| | 592 %w|2a682156a3b6e77a8bf9cd4590e8db757f3c6c78 2a682156a3b6e77a|.each do |r1| |
491 changeset = @repository.find_changeset_by_name(r1) | 593 changeset = @repository.find_changeset_by_name(r1) |
492 assert_nil changeset.next | 594 assert_nil changeset.next |
493 end | 595 end |
494 end | 596 end |
495 else | 597 else |