##// END OF EJS Templates
scm: git: replace "write_attribute" at unit model test for database order consistency (#5357)...
Toshi MARUYAMA -
r8779:421db739c513
parent child
Show More
@@ -1,523 +1,526
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RepositoryGitTest < ActiveSupport::TestCase
21 21 fixtures :projects, :repositories, :enabled_modules, :users, :roles
22 22
23 23 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
24 24 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
25 25
26 26 NUM_REV = 28
27 27 NUM_HEAD = 6
28 28
29 29 FELIX_HEX = "Felix Sch\xC3\xA4fer"
30 30 CHAR_1_HEX = "\xc3\x9c"
31 31
32 32 ## Ruby uses ANSI api to fork a process on Windows.
33 33 ## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem
34 34 ## and these are incompatible with ASCII.
35 35 # WINDOWS_PASS = Redmine::Platform.mswin?
36 36 WINDOWS_PASS = false
37 37
38 38 ## Git, Mercurial and CVS path encodings are binary.
39 39 ## Subversion supports URL encoding for path.
40 40 ## Redmine Mercurial adapter and extension use URL encoding.
41 41 ## Git accepts only binary path in command line parameter.
42 42 ## So, there is no way to use binary command line parameter in JRuby.
43 43 JRUBY_SKIP = (RUBY_PLATFORM == 'java')
44 44 JRUBY_SKIP_STR = "TODO: This test fails in JRuby"
45 45
46 46 if File.directory?(REPOSITORY_PATH)
47 47 def setup
48 48 klass = Repository::Git
49 49 assert_equal "Git", klass.scm_name
50 50 assert klass.scm_adapter_class
51 51 assert_not_equal "", klass.scm_command
52 52 assert_equal true, klass.scm_available
53 53
54 54 @project = Project.find(3)
55 55 @repository = Repository::Git.create(
56 56 :project => @project,
57 57 :url => REPOSITORY_PATH,
58 58 :path_encoding => 'ISO-8859-1'
59 59 )
60 60 assert @repository
61 61 @char_1 = CHAR_1_HEX.dup
62 62 if @char_1.respond_to?(:force_encoding)
63 63 @char_1.force_encoding('UTF-8')
64 64 end
65 65 end
66 66
67 67 def test_fetch_changesets_from_scratch
68 68 assert_nil @repository.extra_info
69 69
70 70 assert_equal 0, @repository.changesets.count
71 71 @repository.fetch_changesets
72 72 @project.reload
73 73
74 74 assert_equal NUM_REV, @repository.changesets.count
75 75 assert_equal 39, @repository.changes.count
76 76
77 77 commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
78 78 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
79 79 assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
80 80 assert_equal "jsmith <jsmith@foo.bar>", commit.committer
81 81 assert_equal User.find_by_login('jsmith'), commit.user
82 82 # TODO: add a commit with commit time <> author time to the test repository
83 83 assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
84 84 assert_equal "2007-12-14".to_date, commit.commit_date
85 85 assert_equal 3, commit.changes.count
86 86 change = commit.changes.sort_by(&:path).first
87 87 assert_equal "README", change.path
88 88 assert_equal "A", change.action
89 89
90 90 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
91 91 end
92 92
93 93 def test_fetch_changesets_incremental
94 94 assert_equal 0, @repository.changesets.count
95 95 @repository.fetch_changesets
96 96 @project.reload
97 97 assert_equal NUM_REV, @repository.changesets.count
98 98 extra_info_heads = @repository.extra_info["heads"].dup
99 99 assert_equal NUM_HEAD, extra_info_heads.size
100 100 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
101 101 assert_equal 4, extra_info_heads.size
102 102
103 103 del_revs = [
104 104 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
105 105 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
106 106 "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
107 107 "deff712f05a90d96edbd70facc47d944be5897e3",
108 108 "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
109 109 "7e61ac704deecde634b51e59daa8110435dcb3da",
110 110 ]
111 111 @repository.changesets.each do |rev|
112 112 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
113 113 end
114 114 @project.reload
115 115 cs1 = @repository.changesets
116 116 assert_equal NUM_REV - 6, cs1.count
117 117 extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
118 118 h = {}
119 119 h["heads"] = extra_info_heads
120 120 @repository.merge_extra_info(h)
121 121 @repository.save
122 122 @project.reload
123 123 assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8")
124 124 @repository.fetch_changesets
125 125 @project.reload
126 126 assert_equal NUM_REV, @repository.changesets.count
127 127 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
128 128 assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c")
129 129 end
130 130
131 131 def test_fetch_changesets_history_editing
132 132 assert_equal 0, @repository.changesets.count
133 133 @repository.fetch_changesets
134 134 @project.reload
135 135 assert_equal NUM_REV, @repository.changesets.count
136 136 extra_info_heads = @repository.extra_info["heads"].dup
137 137 assert_equal NUM_HEAD, extra_info_heads.size
138 138 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
139 139 assert_equal 4, extra_info_heads.size
140 140
141 141 del_revs = [
142 142 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
143 143 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
144 144 "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
145 145 "deff712f05a90d96edbd70facc47d944be5897e3",
146 146 "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
147 147 "7e61ac704deecde634b51e59daa8110435dcb3da",
148 148 ]
149 149 @repository.changesets.each do |rev|
150 150 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
151 151 end
152 152 @project.reload
153 153 assert_equal NUM_REV - 6, @repository.changesets.count
154 154
155 155 c = Changeset.new(:repository => @repository,
156 156 :committed_on => Time.now,
157 157 :revision => "abcd1234efgh",
158 158 :scmid => "abcd1234efgh",
159 159 :comments => 'test')
160 160 assert c.save
161 161 @project.reload
162 162 assert_equal NUM_REV - 5, @repository.changesets.count
163 163
164 164 extra_info_heads << "abcd1234efgh"
165 165 h = {}
166 166 h["heads"] = extra_info_heads
167 167 @repository.merge_extra_info(h)
168 168 @repository.save
169 169 @project.reload
170 170 h1 = @repository.extra_info["heads"].dup
171 171 assert h1.index("abcd1234efgh")
172 172 assert_equal 5, h1.size
173 173
174 174 @repository.fetch_changesets
175 175 @project.reload
176 176 assert_equal NUM_REV - 5, @repository.changesets.count
177 177 h2 = @repository.extra_info["heads"].dup
178 178 assert_equal h1, h2
179 179 end
180 180
181 181 def test_parents
182 182 assert_equal 0, @repository.changesets.count
183 183 @repository.fetch_changesets
184 184 @project.reload
185 185 assert_equal NUM_REV, @repository.changesets.count
186 186 r1 = @repository.find_changeset_by_name("7234cb2750b63")
187 187 assert_equal [], r1.parents
188 188 r2 = @repository.find_changeset_by_name("899a15dba03a3")
189 189 assert_equal 1, r2.parents.length
190 190 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
191 191 r2.parents[0].identifier
192 192 r3 = @repository.find_changeset_by_name("32ae898b720c2")
193 193 assert_equal 2, r3.parents.length
194 194 r4 = [r3.parents[0].identifier, r3.parents[1].identifier].sort
195 195 assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", r4[0]
196 196 assert_equal "7e61ac704deecde634b51e59daa8110435dcb3da", r4[1]
197 197 end
198 198
199 199 def test_db_consistent_ordering_init
200 200 assert_nil @repository.extra_info
201 201 assert_equal 0, @repository.changesets.count
202 202 @repository.fetch_changesets
203 203 @project.reload
204 204 assert_equal 1, @repository.extra_info["db_consistent"]["ordering"]
205 205 end
206 206
207 207 def test_db_consistent_ordering_before_1_2
208 208 assert_nil @repository.extra_info
209 209 assert_equal 0, @repository.changesets.count
210 210 @repository.fetch_changesets
211 211 @project.reload
212 212 assert_equal NUM_REV, @repository.changesets.count
213 213 assert_not_nil @repository.extra_info
214 @repository.write_attribute(:extra_info, nil)
214 h = {}
215 h["heads"] = []
216 h["branches"] = {}
217 h["db_consistent"] = {}
218 @repository.merge_extra_info(h)
215 219 @repository.save
216 assert_nil @repository.extra_info
217 220 assert_equal NUM_REV, @repository.changesets.count
218 221 @repository.fetch_changesets
219 222 @project.reload
220 223 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
221 224
222 225 extra_info_heads = @repository.extra_info["heads"].dup
223 226 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
224 227 del_revs = [
225 228 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
226 229 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
227 230 "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
228 231 "deff712f05a90d96edbd70facc47d944be5897e3",
229 232 "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
230 233 "7e61ac704deecde634b51e59daa8110435dcb3da",
231 234 ]
232 235 @repository.changesets.each do |rev|
233 236 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
234 237 end
235 238 @project.reload
236 239 cs1 = @repository.changesets
237 240 assert_equal NUM_REV - 6, cs1.count
238 241 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
239 242
240 243 extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
241 244 h = {}
242 245 h["heads"] = extra_info_heads
243 246 @repository.merge_extra_info(h)
244 247 @repository.save
245 248 @project.reload
246 249 assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8")
247 250 @repository.fetch_changesets
248 251 @project.reload
249 252 assert_equal NUM_REV, @repository.changesets.count
250 253 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
251 254
252 255 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
253 256 end
254 257
255 258 def test_heads_from_branches_hash
256 259 assert_nil @repository.extra_info
257 260 assert_equal 0, @repository.changesets.count
258 261 assert_equal [], @repository.heads_from_branches_hash
259 262 h = {}
260 263 h["branches"] = {}
261 264 h["branches"]["test1"] = {}
262 265 h["branches"]["test1"]["last_scmid"] = "1234abcd"
263 266 h["branches"]["test2"] = {}
264 267 h["branches"]["test2"]["last_scmid"] = "abcd1234"
265 268 @repository.merge_extra_info(h)
266 269 @repository.save
267 270 @project.reload
268 271 assert_equal ["1234abcd", "abcd1234"], @repository.heads_from_branches_hash.sort
269 272 end
270 273
271 274 def test_latest_changesets
272 275 assert_equal 0, @repository.changesets.count
273 276 @repository.fetch_changesets
274 277 @project.reload
275 278 assert_equal NUM_REV, @repository.changesets.count
276 279 # with limit
277 280 changesets = @repository.latest_changesets('', 'master', 2)
278 281 assert_equal 2, changesets.size
279 282
280 283 # with path
281 284 changesets = @repository.latest_changesets('images', 'master')
282 285 assert_equal [
283 286 'deff712f05a90d96edbd70facc47d944be5897e3',
284 287 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
285 288 '7234cb2750b63f47bff735edc50a1c0a433c2518',
286 289 ], changesets.collect(&:revision)
287 290
288 291 changesets = @repository.latest_changesets('README', nil)
289 292 assert_equal [
290 293 '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf',
291 294 '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8',
292 295 '713f4944648826f558cf548222f813dabe7cbb04',
293 296 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
294 297 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
295 298 '7234cb2750b63f47bff735edc50a1c0a433c2518',
296 299 ], changesets.collect(&:revision)
297 300
298 301 # with path, revision and limit
299 302 changesets = @repository.latest_changesets('images', '899a15dba')
300 303 assert_equal [
301 304 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
302 305 '7234cb2750b63f47bff735edc50a1c0a433c2518',
303 306 ], changesets.collect(&:revision)
304 307
305 308 changesets = @repository.latest_changesets('images', '899a15dba', 1)
306 309 assert_equal [
307 310 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
308 311 ], changesets.collect(&:revision)
309 312
310 313 changesets = @repository.latest_changesets('README', '899a15dba')
311 314 assert_equal [
312 315 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
313 316 '7234cb2750b63f47bff735edc50a1c0a433c2518',
314 317 ], changesets.collect(&:revision)
315 318
316 319 changesets = @repository.latest_changesets('README', '899a15dba', 1)
317 320 assert_equal [
318 321 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
319 322 ], changesets.collect(&:revision)
320 323
321 324 # with path, tag and limit
322 325 changesets = @repository.latest_changesets('images', 'tag01.annotated')
323 326 assert_equal [
324 327 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
325 328 '7234cb2750b63f47bff735edc50a1c0a433c2518',
326 329 ], changesets.collect(&:revision)
327 330
328 331 changesets = @repository.latest_changesets('images', 'tag01.annotated', 1)
329 332 assert_equal [
330 333 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
331 334 ], changesets.collect(&:revision)
332 335
333 336 changesets = @repository.latest_changesets('README', 'tag01.annotated')
334 337 assert_equal [
335 338 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
336 339 '7234cb2750b63f47bff735edc50a1c0a433c2518',
337 340 ], changesets.collect(&:revision)
338 341
339 342 changesets = @repository.latest_changesets('README', 'tag01.annotated', 1)
340 343 assert_equal [
341 344 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
342 345 ], changesets.collect(&:revision)
343 346
344 347 # with path, branch and limit
345 348 changesets = @repository.latest_changesets('images', 'test_branch')
346 349 assert_equal [
347 350 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
348 351 '7234cb2750b63f47bff735edc50a1c0a433c2518',
349 352 ], changesets.collect(&:revision)
350 353
351 354 changesets = @repository.latest_changesets('images', 'test_branch', 1)
352 355 assert_equal [
353 356 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
354 357 ], changesets.collect(&:revision)
355 358
356 359 changesets = @repository.latest_changesets('README', 'test_branch')
357 360 assert_equal [
358 361 '713f4944648826f558cf548222f813dabe7cbb04',
359 362 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
360 363 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
361 364 '7234cb2750b63f47bff735edc50a1c0a433c2518',
362 365 ], changesets.collect(&:revision)
363 366
364 367 changesets = @repository.latest_changesets('README', 'test_branch', 2)
365 368 assert_equal [
366 369 '713f4944648826f558cf548222f813dabe7cbb04',
367 370 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
368 371 ], changesets.collect(&:revision)
369 372
370 373 if JRUBY_SKIP
371 374 puts JRUBY_SKIP_STR
372 375 else
373 376 # latin-1 encoding path
374 377 changesets = @repository.latest_changesets(
375 378 "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89')
376 379 assert_equal [
377 380 '64f1f3e89ad1cb57976ff0ad99a107012ba3481d',
378 381 '4fc55c43bf3d3dc2efb66145365ddc17639ce81e',
379 382 ], changesets.collect(&:revision)
380 383
381 384 changesets = @repository.latest_changesets(
382 385 "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89', 1)
383 386 assert_equal [
384 387 '64f1f3e89ad1cb57976ff0ad99a107012ba3481d',
385 388 ], changesets.collect(&:revision)
386 389 end
387 390 end
388 391
389 392 def test_latest_changesets_latin_1_dir
390 393 if WINDOWS_PASS
391 394 #
392 395 elsif JRUBY_SKIP
393 396 puts JRUBY_SKIP_STR
394 397 else
395 398 assert_equal 0, @repository.changesets.count
396 399 @repository.fetch_changesets
397 400 @project.reload
398 401 assert_equal NUM_REV, @repository.changesets.count
399 402 changesets = @repository.latest_changesets(
400 403 "latin-1-dir/test-#{@char_1}-subdir", '1ca7f5ed')
401 404 assert_equal [
402 405 '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127',
403 406 ], changesets.collect(&:revision)
404 407 end
405 408 end
406 409
407 410 def test_find_changeset_by_name
408 411 assert_equal 0, @repository.changesets.count
409 412 @repository.fetch_changesets
410 413 @project.reload
411 414 assert_equal NUM_REV, @repository.changesets.count
412 415 ['7234cb2750b63f47bff735edc50a1c0a433c2518', '7234cb2750b'].each do |r|
413 416 assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518',
414 417 @repository.find_changeset_by_name(r).revision
415 418 end
416 419 end
417 420
418 421 def test_find_changeset_by_empty_name
419 422 assert_equal 0, @repository.changesets.count
420 423 @repository.fetch_changesets
421 424 @project.reload
422 425 assert_equal NUM_REV, @repository.changesets.count
423 426 ['', ' ', nil].each do |r|
424 427 assert_nil @repository.find_changeset_by_name(r)
425 428 end
426 429 end
427 430
428 431 def test_identifier
429 432 assert_equal 0, @repository.changesets.count
430 433 @repository.fetch_changesets
431 434 @project.reload
432 435 assert_equal NUM_REV, @repository.changesets.count
433 436 c = @repository.changesets.find_by_revision(
434 437 '7234cb2750b63f47bff735edc50a1c0a433c2518')
435 438 assert_equal c.scmid, c.identifier
436 439 end
437 440
438 441 def test_format_identifier
439 442 assert_equal 0, @repository.changesets.count
440 443 @repository.fetch_changesets
441 444 @project.reload
442 445 assert_equal NUM_REV, @repository.changesets.count
443 446 c = @repository.changesets.find_by_revision(
444 447 '7234cb2750b63f47bff735edc50a1c0a433c2518')
445 448 assert_equal '7234cb27', c.format_identifier
446 449 end
447 450
448 451 def test_activities
449 452 c = Changeset.new(:repository => @repository,
450 453 :committed_on => Time.now,
451 454 :revision => 'abc7234cb2750b63f47bff735edc50a1c0a433c2',
452 455 :scmid => 'abc7234cb2750b63f47bff735edc50a1c0a433c2',
453 456 :comments => 'test')
454 457 assert c.event_title.include?('abc7234c:')
455 458 assert_equal 'abc7234cb2750b63f47bff735edc50a1c0a433c2', c.event_url[:rev]
456 459 end
457 460
458 461 def test_log_utf8
459 462 assert_equal 0, @repository.changesets.count
460 463 @repository.fetch_changesets
461 464 @project.reload
462 465 assert_equal NUM_REV, @repository.changesets.count
463 466 str_felix_hex = FELIX_HEX.dup
464 467 if str_felix_hex.respond_to?(:force_encoding)
465 468 str_felix_hex.force_encoding('UTF-8')
466 469 end
467 470 c = @repository.changesets.find_by_revision(
468 471 'ed5bb786bbda2dee66a2d50faf51429dbc043a7b')
469 472 assert_equal "#{str_felix_hex} <felix@fachschaften.org>", c.committer
470 473 end
471 474
472 475 def test_previous
473 476 assert_equal 0, @repository.changesets.count
474 477 @repository.fetch_changesets
475 478 @project.reload
476 479 assert_equal NUM_REV, @repository.changesets.count
477 480 %w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
478 481 changeset = @repository.find_changeset_by_name(r1)
479 482 %w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2|
480 483 assert_equal @repository.find_changeset_by_name(r2), changeset.previous
481 484 end
482 485 end
483 486 end
484 487
485 488 def test_previous_nil
486 489 assert_equal 0, @repository.changesets.count
487 490 @repository.fetch_changesets
488 491 @project.reload
489 492 assert_equal NUM_REV, @repository.changesets.count
490 493 %w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb275|.each do |r1|
491 494 changeset = @repository.find_changeset_by_name(r1)
492 495 assert_nil changeset.previous
493 496 end
494 497 end
495 498
496 499 def test_next
497 500 assert_equal 0, @repository.changesets.count
498 501 @repository.fetch_changesets
499 502 @project.reload
500 503 assert_equal NUM_REV, @repository.changesets.count
501 504 %w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2|
502 505 changeset = @repository.find_changeset_by_name(r2)
503 506 %w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
504 507 assert_equal @repository.find_changeset_by_name(r1), changeset.next
505 508 end
506 509 end
507 510 end
508 511
509 512 def test_next_nil
510 513 assert_equal 0, @repository.changesets.count
511 514 @repository.fetch_changesets
512 515 @project.reload
513 516 assert_equal NUM_REV, @repository.changesets.count
514 517 %w|2a682156a3b6e77a8bf9cd4590e8db757f3c6c78 2a682156a3b6e77a|.each do |r1|
515 518 changeset = @repository.find_changeset_by_name(r1)
516 519 assert_nil changeset.next
517 520 end
518 521 end
519 522 else
520 523 puts "Git test repository NOT FOUND. Skipping unit tests !!!"
521 524 def test_fake; assert true end
522 525 end
523 526 end
General Comments 0
You need to be logged in to leave comments. Login now