##// END OF EJS Templates
scm: git: replace "order" at unit model test of fetching from scratch (#5357)...
Toshi MARUYAMA -
r8778:ff65babd1c38
parent child
Show More
@@ -1,524 +1,523
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 commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
77 commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
78 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
78 79 assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
79 80 assert_equal "jsmith <jsmith@foo.bar>", commit.committer
80 81 assert_equal User.find_by_login('jsmith'), commit.user
81 82 # TODO: add a commit with commit time <> author time to the test repository
82 83 assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
83 84 assert_equal "2007-12-14".to_date, commit.commit_date
84 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.revision
85 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
86 85 assert_equal 3, commit.changes.count
87 86 change = commit.changes.sort_by(&:path).first
88 87 assert_equal "README", change.path
89 88 assert_equal "A", change.action
90 89
91 90 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
92 91 end
93 92
94 93 def test_fetch_changesets_incremental
95 94 assert_equal 0, @repository.changesets.count
96 95 @repository.fetch_changesets
97 96 @project.reload
98 97 assert_equal NUM_REV, @repository.changesets.count
99 98 extra_info_heads = @repository.extra_info["heads"].dup
100 99 assert_equal NUM_HEAD, extra_info_heads.size
101 100 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
102 101 assert_equal 4, extra_info_heads.size
103 102
104 103 del_revs = [
105 104 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
106 105 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
107 106 "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
108 107 "deff712f05a90d96edbd70facc47d944be5897e3",
109 108 "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
110 109 "7e61ac704deecde634b51e59daa8110435dcb3da",
111 110 ]
112 111 @repository.changesets.each do |rev|
113 112 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
114 113 end
115 114 @project.reload
116 115 cs1 = @repository.changesets
117 116 assert_equal NUM_REV - 6, cs1.count
118 117 extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
119 118 h = {}
120 119 h["heads"] = extra_info_heads
121 120 @repository.merge_extra_info(h)
122 121 @repository.save
123 122 @project.reload
124 123 assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8")
125 124 @repository.fetch_changesets
126 125 @project.reload
127 126 assert_equal NUM_REV, @repository.changesets.count
128 127 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
129 128 assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c")
130 129 end
131 130
132 131 def test_fetch_changesets_history_editing
133 132 assert_equal 0, @repository.changesets.count
134 133 @repository.fetch_changesets
135 134 @project.reload
136 135 assert_equal NUM_REV, @repository.changesets.count
137 136 extra_info_heads = @repository.extra_info["heads"].dup
138 137 assert_equal NUM_HEAD, extra_info_heads.size
139 138 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
140 139 assert_equal 4, extra_info_heads.size
141 140
142 141 del_revs = [
143 142 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
144 143 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
145 144 "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
146 145 "deff712f05a90d96edbd70facc47d944be5897e3",
147 146 "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
148 147 "7e61ac704deecde634b51e59daa8110435dcb3da",
149 148 ]
150 149 @repository.changesets.each do |rev|
151 150 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
152 151 end
153 152 @project.reload
154 153 assert_equal NUM_REV - 6, @repository.changesets.count
155 154
156 155 c = Changeset.new(:repository => @repository,
157 156 :committed_on => Time.now,
158 157 :revision => "abcd1234efgh",
159 158 :scmid => "abcd1234efgh",
160 159 :comments => 'test')
161 160 assert c.save
162 161 @project.reload
163 162 assert_equal NUM_REV - 5, @repository.changesets.count
164 163
165 164 extra_info_heads << "abcd1234efgh"
166 165 h = {}
167 166 h["heads"] = extra_info_heads
168 167 @repository.merge_extra_info(h)
169 168 @repository.save
170 169 @project.reload
171 170 h1 = @repository.extra_info["heads"].dup
172 171 assert h1.index("abcd1234efgh")
173 172 assert_equal 5, h1.size
174 173
175 174 @repository.fetch_changesets
176 175 @project.reload
177 176 assert_equal NUM_REV - 5, @repository.changesets.count
178 177 h2 = @repository.extra_info["heads"].dup
179 178 assert_equal h1, h2
180 179 end
181 180
182 181 def test_parents
183 182 assert_equal 0, @repository.changesets.count
184 183 @repository.fetch_changesets
185 184 @project.reload
186 185 assert_equal NUM_REV, @repository.changesets.count
187 186 r1 = @repository.find_changeset_by_name("7234cb2750b63")
188 187 assert_equal [], r1.parents
189 188 r2 = @repository.find_changeset_by_name("899a15dba03a3")
190 189 assert_equal 1, r2.parents.length
191 190 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
192 191 r2.parents[0].identifier
193 192 r3 = @repository.find_changeset_by_name("32ae898b720c2")
194 193 assert_equal 2, r3.parents.length
195 194 r4 = [r3.parents[0].identifier, r3.parents[1].identifier].sort
196 195 assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", r4[0]
197 196 assert_equal "7e61ac704deecde634b51e59daa8110435dcb3da", r4[1]
198 197 end
199 198
200 199 def test_db_consistent_ordering_init
201 200 assert_nil @repository.extra_info
202 201 assert_equal 0, @repository.changesets.count
203 202 @repository.fetch_changesets
204 203 @project.reload
205 204 assert_equal 1, @repository.extra_info["db_consistent"]["ordering"]
206 205 end
207 206
208 207 def test_db_consistent_ordering_before_1_2
209 208 assert_nil @repository.extra_info
210 209 assert_equal 0, @repository.changesets.count
211 210 @repository.fetch_changesets
212 211 @project.reload
213 212 assert_equal NUM_REV, @repository.changesets.count
214 213 assert_not_nil @repository.extra_info
215 214 @repository.write_attribute(:extra_info, nil)
216 215 @repository.save
217 216 assert_nil @repository.extra_info
218 217 assert_equal NUM_REV, @repository.changesets.count
219 218 @repository.fetch_changesets
220 219 @project.reload
221 220 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
222 221
223 222 extra_info_heads = @repository.extra_info["heads"].dup
224 223 extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
225 224 del_revs = [
226 225 "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
227 226 "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
228 227 "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
229 228 "deff712f05a90d96edbd70facc47d944be5897e3",
230 229 "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
231 230 "7e61ac704deecde634b51e59daa8110435dcb3da",
232 231 ]
233 232 @repository.changesets.each do |rev|
234 233 rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
235 234 end
236 235 @project.reload
237 236 cs1 = @repository.changesets
238 237 assert_equal NUM_REV - 6, cs1.count
239 238 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
240 239
241 240 extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
242 241 h = {}
243 242 h["heads"] = extra_info_heads
244 243 @repository.merge_extra_info(h)
245 244 @repository.save
246 245 @project.reload
247 246 assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8")
248 247 @repository.fetch_changesets
249 248 @project.reload
250 249 assert_equal NUM_REV, @repository.changesets.count
251 250 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
252 251
253 252 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
254 253 end
255 254
256 255 def test_heads_from_branches_hash
257 256 assert_nil @repository.extra_info
258 257 assert_equal 0, @repository.changesets.count
259 258 assert_equal [], @repository.heads_from_branches_hash
260 259 h = {}
261 260 h["branches"] = {}
262 261 h["branches"]["test1"] = {}
263 262 h["branches"]["test1"]["last_scmid"] = "1234abcd"
264 263 h["branches"]["test2"] = {}
265 264 h["branches"]["test2"]["last_scmid"] = "abcd1234"
266 265 @repository.merge_extra_info(h)
267 266 @repository.save
268 267 @project.reload
269 268 assert_equal ["1234abcd", "abcd1234"], @repository.heads_from_branches_hash.sort
270 269 end
271 270
272 271 def test_latest_changesets
273 272 assert_equal 0, @repository.changesets.count
274 273 @repository.fetch_changesets
275 274 @project.reload
276 275 assert_equal NUM_REV, @repository.changesets.count
277 276 # with limit
278 277 changesets = @repository.latest_changesets('', 'master', 2)
279 278 assert_equal 2, changesets.size
280 279
281 280 # with path
282 281 changesets = @repository.latest_changesets('images', 'master')
283 282 assert_equal [
284 283 'deff712f05a90d96edbd70facc47d944be5897e3',
285 284 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
286 285 '7234cb2750b63f47bff735edc50a1c0a433c2518',
287 286 ], changesets.collect(&:revision)
288 287
289 288 changesets = @repository.latest_changesets('README', nil)
290 289 assert_equal [
291 290 '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf',
292 291 '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8',
293 292 '713f4944648826f558cf548222f813dabe7cbb04',
294 293 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
295 294 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
296 295 '7234cb2750b63f47bff735edc50a1c0a433c2518',
297 296 ], changesets.collect(&:revision)
298 297
299 298 # with path, revision and limit
300 299 changesets = @repository.latest_changesets('images', '899a15dba')
301 300 assert_equal [
302 301 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
303 302 '7234cb2750b63f47bff735edc50a1c0a433c2518',
304 303 ], changesets.collect(&:revision)
305 304
306 305 changesets = @repository.latest_changesets('images', '899a15dba', 1)
307 306 assert_equal [
308 307 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
309 308 ], changesets.collect(&:revision)
310 309
311 310 changesets = @repository.latest_changesets('README', '899a15dba')
312 311 assert_equal [
313 312 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
314 313 '7234cb2750b63f47bff735edc50a1c0a433c2518',
315 314 ], changesets.collect(&:revision)
316 315
317 316 changesets = @repository.latest_changesets('README', '899a15dba', 1)
318 317 assert_equal [
319 318 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
320 319 ], changesets.collect(&:revision)
321 320
322 321 # with path, tag and limit
323 322 changesets = @repository.latest_changesets('images', 'tag01.annotated')
324 323 assert_equal [
325 324 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
326 325 '7234cb2750b63f47bff735edc50a1c0a433c2518',
327 326 ], changesets.collect(&:revision)
328 327
329 328 changesets = @repository.latest_changesets('images', 'tag01.annotated', 1)
330 329 assert_equal [
331 330 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
332 331 ], changesets.collect(&:revision)
333 332
334 333 changesets = @repository.latest_changesets('README', 'tag01.annotated')
335 334 assert_equal [
336 335 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
337 336 '7234cb2750b63f47bff735edc50a1c0a433c2518',
338 337 ], changesets.collect(&:revision)
339 338
340 339 changesets = @repository.latest_changesets('README', 'tag01.annotated', 1)
341 340 assert_equal [
342 341 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
343 342 ], changesets.collect(&:revision)
344 343
345 344 # with path, branch and limit
346 345 changesets = @repository.latest_changesets('images', 'test_branch')
347 346 assert_equal [
348 347 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
349 348 '7234cb2750b63f47bff735edc50a1c0a433c2518',
350 349 ], changesets.collect(&:revision)
351 350
352 351 changesets = @repository.latest_changesets('images', 'test_branch', 1)
353 352 assert_equal [
354 353 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
355 354 ], changesets.collect(&:revision)
356 355
357 356 changesets = @repository.latest_changesets('README', 'test_branch')
358 357 assert_equal [
359 358 '713f4944648826f558cf548222f813dabe7cbb04',
360 359 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
361 360 '899a15dba03a3b350b89c3f537e4bbe02a03cdc9',
362 361 '7234cb2750b63f47bff735edc50a1c0a433c2518',
363 362 ], changesets.collect(&:revision)
364 363
365 364 changesets = @repository.latest_changesets('README', 'test_branch', 2)
366 365 assert_equal [
367 366 '713f4944648826f558cf548222f813dabe7cbb04',
368 367 '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
369 368 ], changesets.collect(&:revision)
370 369
371 370 if JRUBY_SKIP
372 371 puts JRUBY_SKIP_STR
373 372 else
374 373 # latin-1 encoding path
375 374 changesets = @repository.latest_changesets(
376 375 "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89')
377 376 assert_equal [
378 377 '64f1f3e89ad1cb57976ff0ad99a107012ba3481d',
379 378 '4fc55c43bf3d3dc2efb66145365ddc17639ce81e',
380 379 ], changesets.collect(&:revision)
381 380
382 381 changesets = @repository.latest_changesets(
383 382 "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89', 1)
384 383 assert_equal [
385 384 '64f1f3e89ad1cb57976ff0ad99a107012ba3481d',
386 385 ], changesets.collect(&:revision)
387 386 end
388 387 end
389 388
390 389 def test_latest_changesets_latin_1_dir
391 390 if WINDOWS_PASS
392 391 #
393 392 elsif JRUBY_SKIP
394 393 puts JRUBY_SKIP_STR
395 394 else
396 395 assert_equal 0, @repository.changesets.count
397 396 @repository.fetch_changesets
398 397 @project.reload
399 398 assert_equal NUM_REV, @repository.changesets.count
400 399 changesets = @repository.latest_changesets(
401 400 "latin-1-dir/test-#{@char_1}-subdir", '1ca7f5ed')
402 401 assert_equal [
403 402 '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127',
404 403 ], changesets.collect(&:revision)
405 404 end
406 405 end
407 406
408 407 def test_find_changeset_by_name
409 408 assert_equal 0, @repository.changesets.count
410 409 @repository.fetch_changesets
411 410 @project.reload
412 411 assert_equal NUM_REV, @repository.changesets.count
413 412 ['7234cb2750b63f47bff735edc50a1c0a433c2518', '7234cb2750b'].each do |r|
414 413 assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518',
415 414 @repository.find_changeset_by_name(r).revision
416 415 end
417 416 end
418 417
419 418 def test_find_changeset_by_empty_name
420 419 assert_equal 0, @repository.changesets.count
421 420 @repository.fetch_changesets
422 421 @project.reload
423 422 assert_equal NUM_REV, @repository.changesets.count
424 423 ['', ' ', nil].each do |r|
425 424 assert_nil @repository.find_changeset_by_name(r)
426 425 end
427 426 end
428 427
429 428 def test_identifier
430 429 assert_equal 0, @repository.changesets.count
431 430 @repository.fetch_changesets
432 431 @project.reload
433 432 assert_equal NUM_REV, @repository.changesets.count
434 433 c = @repository.changesets.find_by_revision(
435 434 '7234cb2750b63f47bff735edc50a1c0a433c2518')
436 435 assert_equal c.scmid, c.identifier
437 436 end
438 437
439 438 def test_format_identifier
440 439 assert_equal 0, @repository.changesets.count
441 440 @repository.fetch_changesets
442 441 @project.reload
443 442 assert_equal NUM_REV, @repository.changesets.count
444 443 c = @repository.changesets.find_by_revision(
445 444 '7234cb2750b63f47bff735edc50a1c0a433c2518')
446 445 assert_equal '7234cb27', c.format_identifier
447 446 end
448 447
449 448 def test_activities
450 449 c = Changeset.new(:repository => @repository,
451 450 :committed_on => Time.now,
452 451 :revision => 'abc7234cb2750b63f47bff735edc50a1c0a433c2',
453 452 :scmid => 'abc7234cb2750b63f47bff735edc50a1c0a433c2',
454 453 :comments => 'test')
455 454 assert c.event_title.include?('abc7234c:')
456 455 assert_equal 'abc7234cb2750b63f47bff735edc50a1c0a433c2', c.event_url[:rev]
457 456 end
458 457
459 458 def test_log_utf8
460 459 assert_equal 0, @repository.changesets.count
461 460 @repository.fetch_changesets
462 461 @project.reload
463 462 assert_equal NUM_REV, @repository.changesets.count
464 463 str_felix_hex = FELIX_HEX.dup
465 464 if str_felix_hex.respond_to?(:force_encoding)
466 465 str_felix_hex.force_encoding('UTF-8')
467 466 end
468 467 c = @repository.changesets.find_by_revision(
469 468 'ed5bb786bbda2dee66a2d50faf51429dbc043a7b')
470 469 assert_equal "#{str_felix_hex} <felix@fachschaften.org>", c.committer
471 470 end
472 471
473 472 def test_previous
474 473 assert_equal 0, @repository.changesets.count
475 474 @repository.fetch_changesets
476 475 @project.reload
477 476 assert_equal NUM_REV, @repository.changesets.count
478 477 %w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
479 478 changeset = @repository.find_changeset_by_name(r1)
480 479 %w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2|
481 480 assert_equal @repository.find_changeset_by_name(r2), changeset.previous
482 481 end
483 482 end
484 483 end
485 484
486 485 def test_previous_nil
487 486 assert_equal 0, @repository.changesets.count
488 487 @repository.fetch_changesets
489 488 @project.reload
490 489 assert_equal NUM_REV, @repository.changesets.count
491 490 %w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb275|.each do |r1|
492 491 changeset = @repository.find_changeset_by_name(r1)
493 492 assert_nil changeset.previous
494 493 end
495 494 end
496 495
497 496 def test_next
498 497 assert_equal 0, @repository.changesets.count
499 498 @repository.fetch_changesets
500 499 @project.reload
501 500 assert_equal NUM_REV, @repository.changesets.count
502 501 %w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2|
503 502 changeset = @repository.find_changeset_by_name(r2)
504 503 %w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
505 504 assert_equal @repository.find_changeset_by_name(r1), changeset.next
506 505 end
507 506 end
508 507 end
509 508
510 509 def test_next_nil
511 510 assert_equal 0, @repository.changesets.count
512 511 @repository.fetch_changesets
513 512 @project.reload
514 513 assert_equal NUM_REV, @repository.changesets.count
515 514 %w|2a682156a3b6e77a8bf9cd4590e8db757f3c6c78 2a682156a3b6e77a|.each do |r1|
516 515 changeset = @repository.find_changeset_by_name(r1)
517 516 assert_nil changeset.next
518 517 end
519 518 end
520 519 else
521 520 puts "Git test repository NOT FOUND. Skipping unit tests !!!"
522 521 def test_fake; assert true end
523 522 end
524 523 end
General Comments 0
You need to be logged in to leave comments. Login now