##// END OF EJS Templates
scm: mercurial: use NUM_REV instead of hard-coded number of revisions at "test_fetch_changesets_incremental" of unit model test...
Toshi MARUYAMA -
r7532:520a8e6f15e2
parent child
Show More
@@ -1,324 +1,324
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class RepositoryMercurialTest < ActiveSupport::TestCase
20 class RepositoryMercurialTest < ActiveSupport::TestCase
21 fixtures :projects
21 fixtures :projects
22
22
23 REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
23 REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
24 NUM_REV = 29
24 NUM_REV = 29
25 CHAR_1_HEX = "\xc3\x9c"
25 CHAR_1_HEX = "\xc3\x9c"
26
26
27 if File.directory?(REPOSITORY_PATH)
27 if File.directory?(REPOSITORY_PATH)
28 def setup
28 def setup
29 klass = Repository::Mercurial
29 klass = Repository::Mercurial
30 assert_equal "Mercurial", klass.scm_name
30 assert_equal "Mercurial", klass.scm_name
31 assert klass.scm_adapter_class
31 assert klass.scm_adapter_class
32 assert_not_equal "", klass.scm_command
32 assert_not_equal "", klass.scm_command
33 assert_equal true, klass.scm_available
33 assert_equal true, klass.scm_available
34
34
35 @project = Project.find(3)
35 @project = Project.find(3)
36 @repository = Repository::Mercurial.create(
36 @repository = Repository::Mercurial.create(
37 :project => @project,
37 :project => @project,
38 :url => REPOSITORY_PATH,
38 :url => REPOSITORY_PATH,
39 :path_encoding => 'ISO-8859-1'
39 :path_encoding => 'ISO-8859-1'
40 )
40 )
41 assert @repository
41 assert @repository
42 @char_1 = CHAR_1_HEX.dup
42 @char_1 = CHAR_1_HEX.dup
43 @tag_char_1 = "tag-#{CHAR_1_HEX}-00"
43 @tag_char_1 = "tag-#{CHAR_1_HEX}-00"
44 @branch_char_0 = "branch-#{CHAR_1_HEX}-00"
44 @branch_char_0 = "branch-#{CHAR_1_HEX}-00"
45 @branch_char_1 = "branch-#{CHAR_1_HEX}-01"
45 @branch_char_1 = "branch-#{CHAR_1_HEX}-01"
46 if @char_1.respond_to?(:force_encoding)
46 if @char_1.respond_to?(:force_encoding)
47 @char_1.force_encoding('UTF-8')
47 @char_1.force_encoding('UTF-8')
48 @tag_char_1.force_encoding('UTF-8')
48 @tag_char_1.force_encoding('UTF-8')
49 @branch_char_0.force_encoding('UTF-8')
49 @branch_char_0.force_encoding('UTF-8')
50 @branch_char_1.force_encoding('UTF-8')
50 @branch_char_1.force_encoding('UTF-8')
51 end
51 end
52 end
52 end
53
53
54 def test_fetch_changesets_from_scratch
54 def test_fetch_changesets_from_scratch
55 assert_equal 0, @repository.changesets.count
55 assert_equal 0, @repository.changesets.count
56 @repository.fetch_changesets
56 @repository.fetch_changesets
57 @project.reload
57 @project.reload
58 assert_equal NUM_REV, @repository.changesets.count
58 assert_equal NUM_REV, @repository.changesets.count
59 assert_equal 37, @repository.changes.count
59 assert_equal 37, @repository.changes.count
60 assert_equal "Initial import.\nThe repository contains 3 files.",
60 assert_equal "Initial import.\nThe repository contains 3 files.",
61 @repository.changesets.find_by_revision('0').comments
61 @repository.changesets.find_by_revision('0').comments
62 end
62 end
63
63
64 def test_fetch_changesets_incremental
64 def test_fetch_changesets_incremental
65 assert_equal 0, @repository.changesets.count
65 assert_equal 0, @repository.changesets.count
66 @repository.fetch_changesets
66 @repository.fetch_changesets
67 @project.reload
67 @project.reload
68 assert_equal NUM_REV, @repository.changesets.count
68 assert_equal NUM_REV, @repository.changesets.count
69 # Remove changesets with revision > 2
69 # Remove changesets with revision > 2
70 @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2}
70 @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2}
71 @project.reload
71 @project.reload
72 assert_equal 3, @repository.changesets.count
72 assert_equal 3, @repository.changesets.count
73
73
74 @repository.fetch_changesets
74 @repository.fetch_changesets
75 @project.reload
75 @project.reload
76 assert_equal 29, @repository.changesets.count
76 assert_equal NUM_REV, @repository.changesets.count
77 end
77 end
78
78
79 def test_isodatesec
79 def test_isodatesec
80 # Template keyword 'isodatesec' supported in Mercurial 1.0 and higher
80 # Template keyword 'isodatesec' supported in Mercurial 1.0 and higher
81 if @repository.scm.class.client_version_above?([1, 0])
81 if @repository.scm.class.client_version_above?([1, 0])
82 assert_equal 0, @repository.changesets.count
82 assert_equal 0, @repository.changesets.count
83 @repository.fetch_changesets
83 @repository.fetch_changesets
84 @project.reload
84 @project.reload
85 assert_equal NUM_REV, @repository.changesets.count
85 assert_equal NUM_REV, @repository.changesets.count
86 rev0_committed_on = Time.gm(2007, 12, 14, 9, 22, 52)
86 rev0_committed_on = Time.gm(2007, 12, 14, 9, 22, 52)
87 assert_equal @repository.changesets.find_by_revision('0').committed_on, rev0_committed_on
87 assert_equal @repository.changesets.find_by_revision('0').committed_on, rev0_committed_on
88 end
88 end
89 end
89 end
90
90
91 def test_changeset_order_by_revision
91 def test_changeset_order_by_revision
92 assert_equal 0, @repository.changesets.count
92 assert_equal 0, @repository.changesets.count
93 @repository.fetch_changesets
93 @repository.fetch_changesets
94 @project.reload
94 @project.reload
95 assert_equal NUM_REV, @repository.changesets.count
95 assert_equal NUM_REV, @repository.changesets.count
96
96
97 c0 = @repository.latest_changeset
97 c0 = @repository.latest_changeset
98 c1 = @repository.changesets.find_by_revision('0')
98 c1 = @repository.changesets.find_by_revision('0')
99 # sorted by revision (id), not by date
99 # sorted by revision (id), not by date
100 assert c0.revision.to_i > c1.revision.to_i
100 assert c0.revision.to_i > c1.revision.to_i
101 assert c0.committed_on < c1.committed_on
101 assert c0.committed_on < c1.committed_on
102 end
102 end
103
103
104 def test_latest_changesets
104 def test_latest_changesets
105 assert_equal 0, @repository.changesets.count
105 assert_equal 0, @repository.changesets.count
106 @repository.fetch_changesets
106 @repository.fetch_changesets
107 @project.reload
107 @project.reload
108 assert_equal NUM_REV, @repository.changesets.count
108 assert_equal NUM_REV, @repository.changesets.count
109
109
110 # with_limit
110 # with_limit
111 changesets = @repository.latest_changesets('', nil, 2)
111 changesets = @repository.latest_changesets('', nil, 2)
112 assert_equal %w|28 27|, changesets.collect(&:revision)
112 assert_equal %w|28 27|, changesets.collect(&:revision)
113
113
114 # with_filepath
114 # with_filepath
115 changesets = @repository.latest_changesets(
115 changesets = @repository.latest_changesets(
116 '/sql_escape/percent%dir/percent%file1.txt', nil)
116 '/sql_escape/percent%dir/percent%file1.txt', nil)
117 assert_equal %w|11 10 9|, changesets.collect(&:revision)
117 assert_equal %w|11 10 9|, changesets.collect(&:revision)
118
118
119 changesets = @repository.latest_changesets(
119 changesets = @repository.latest_changesets(
120 '/sql_escape/underscore_dir/understrike_file.txt', nil)
120 '/sql_escape/underscore_dir/understrike_file.txt', nil)
121 assert_equal %w|12 9|, changesets.collect(&:revision)
121 assert_equal %w|12 9|, changesets.collect(&:revision)
122
122
123 changesets = @repository.latest_changesets('README', nil)
123 changesets = @repository.latest_changesets('README', nil)
124 assert_equal %w|28 17 8 6 1 0|, changesets.collect(&:revision)
124 assert_equal %w|28 17 8 6 1 0|, changesets.collect(&:revision)
125
125
126 changesets = @repository.latest_changesets('README','8')
126 changesets = @repository.latest_changesets('README','8')
127 assert_equal %w|8 6 1 0|, changesets.collect(&:revision)
127 assert_equal %w|8 6 1 0|, changesets.collect(&:revision)
128
128
129 changesets = @repository.latest_changesets('README','8', 2)
129 changesets = @repository.latest_changesets('README','8', 2)
130 assert_equal %w|8 6|, changesets.collect(&:revision)
130 assert_equal %w|8 6|, changesets.collect(&:revision)
131
131
132 # with_dirpath
132 # with_dirpath
133 changesets = @repository.latest_changesets('images', nil)
133 changesets = @repository.latest_changesets('images', nil)
134 assert_equal %w|1 0|, changesets.collect(&:revision)
134 assert_equal %w|1 0|, changesets.collect(&:revision)
135
135
136 path = 'sql_escape/percent%dir'
136 path = 'sql_escape/percent%dir'
137 changesets = @repository.latest_changesets(path, nil)
137 changesets = @repository.latest_changesets(path, nil)
138 assert_equal %w|13 11 10 9|, changesets.collect(&:revision)
138 assert_equal %w|13 11 10 9|, changesets.collect(&:revision)
139
139
140 changesets = @repository.latest_changesets(path, '11')
140 changesets = @repository.latest_changesets(path, '11')
141 assert_equal %w|11 10 9|, changesets.collect(&:revision)
141 assert_equal %w|11 10 9|, changesets.collect(&:revision)
142
142
143 changesets = @repository.latest_changesets(path, '11', 2)
143 changesets = @repository.latest_changesets(path, '11', 2)
144 assert_equal %w|11 10|, changesets.collect(&:revision)
144 assert_equal %w|11 10|, changesets.collect(&:revision)
145
145
146 path = 'sql_escape/underscore_dir'
146 path = 'sql_escape/underscore_dir'
147 changesets = @repository.latest_changesets(path, nil)
147 changesets = @repository.latest_changesets(path, nil)
148 assert_equal %w|13 12 9|, changesets.collect(&:revision)
148 assert_equal %w|13 12 9|, changesets.collect(&:revision)
149
149
150 changesets = @repository.latest_changesets(path, '12')
150 changesets = @repository.latest_changesets(path, '12')
151 assert_equal %w|12 9|, changesets.collect(&:revision)
151 assert_equal %w|12 9|, changesets.collect(&:revision)
152
152
153 changesets = @repository.latest_changesets(path, '12', 1)
153 changesets = @repository.latest_changesets(path, '12', 1)
154 assert_equal %w|12|, changesets.collect(&:revision)
154 assert_equal %w|12|, changesets.collect(&:revision)
155
155
156 # tag
156 # tag
157 changesets = @repository.latest_changesets('', 'tag_test.00')
157 changesets = @repository.latest_changesets('', 'tag_test.00')
158 assert_equal %w|5 4 3 2 1 0|, changesets.collect(&:revision)
158 assert_equal %w|5 4 3 2 1 0|, changesets.collect(&:revision)
159
159
160 changesets = @repository.latest_changesets('', 'tag_test.00', 2)
160 changesets = @repository.latest_changesets('', 'tag_test.00', 2)
161 assert_equal %w|5 4|, changesets.collect(&:revision)
161 assert_equal %w|5 4|, changesets.collect(&:revision)
162
162
163 changesets = @repository.latest_changesets('sources', 'tag_test.00')
163 changesets = @repository.latest_changesets('sources', 'tag_test.00')
164 assert_equal %w|4 3 2 1 0|, changesets.collect(&:revision)
164 assert_equal %w|4 3 2 1 0|, changesets.collect(&:revision)
165
165
166 changesets = @repository.latest_changesets('sources', 'tag_test.00', 2)
166 changesets = @repository.latest_changesets('sources', 'tag_test.00', 2)
167 assert_equal %w|4 3|, changesets.collect(&:revision)
167 assert_equal %w|4 3|, changesets.collect(&:revision)
168
168
169 # named branch
169 # named branch
170 if @repository.scm.class.client_version_above?([1, 6])
170 if @repository.scm.class.client_version_above?([1, 6])
171 changesets = @repository.latest_changesets('', @branch_char_1)
171 changesets = @repository.latest_changesets('', @branch_char_1)
172 assert_equal %w|27 26|, changesets.collect(&:revision)
172 assert_equal %w|27 26|, changesets.collect(&:revision)
173 end
173 end
174
174
175 changesets = @repository.latest_changesets("latin-1-dir/test-#{@char_1}-subdir", @branch_char_1)
175 changesets = @repository.latest_changesets("latin-1-dir/test-#{@char_1}-subdir", @branch_char_1)
176 assert_equal %w|27|, changesets.collect(&:revision)
176 assert_equal %w|27|, changesets.collect(&:revision)
177 end
177 end
178
178
179 def test_copied_files
179 def test_copied_files
180 assert_equal 0, @repository.changesets.count
180 assert_equal 0, @repository.changesets.count
181 @repository.fetch_changesets
181 @repository.fetch_changesets
182 @project.reload
182 @project.reload
183 assert_equal NUM_REV, @repository.changesets.count
183 assert_equal NUM_REV, @repository.changesets.count
184
184
185 cs1 = @repository.changesets.find_by_revision('13')
185 cs1 = @repository.changesets.find_by_revision('13')
186 assert_not_nil cs1
186 assert_not_nil cs1
187 c1 = cs1.changes.sort_by(&:path)
187 c1 = cs1.changes.sort_by(&:path)
188 assert_equal 2, c1.size
188 assert_equal 2, c1.size
189
189
190 assert_equal 'A', c1[0].action
190 assert_equal 'A', c1[0].action
191 assert_equal '/sql_escape/percent%dir/percentfile1.txt', c1[0].path
191 assert_equal '/sql_escape/percent%dir/percentfile1.txt', c1[0].path
192 assert_equal '/sql_escape/percent%dir/percent%file1.txt', c1[0].from_path
192 assert_equal '/sql_escape/percent%dir/percent%file1.txt', c1[0].from_path
193 assert_equal '3a330eb32958', c1[0].from_revision
193 assert_equal '3a330eb32958', c1[0].from_revision
194
194
195 assert_equal 'A', c1[1].action
195 assert_equal 'A', c1[1].action
196 assert_equal '/sql_escape/underscore_dir/understrike-file.txt', c1[1].path
196 assert_equal '/sql_escape/underscore_dir/understrike-file.txt', c1[1].path
197 assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
197 assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
198
198
199 cs2 = @repository.changesets.find_by_revision('15')
199 cs2 = @repository.changesets.find_by_revision('15')
200 c2 = cs2.changes
200 c2 = cs2.changes
201 assert_equal 1, c2.size
201 assert_equal 1, c2.size
202
202
203 assert_equal 'A', c2[0].action
203 assert_equal 'A', c2[0].action
204 assert_equal '/README (1)[2]&,%.-3_4', c2[0].path
204 assert_equal '/README (1)[2]&,%.-3_4', c2[0].path
205 assert_equal '/README', c2[0].from_path
205 assert_equal '/README', c2[0].from_path
206 assert_equal '933ca60293d7', c2[0].from_revision
206 assert_equal '933ca60293d7', c2[0].from_revision
207
207
208 cs3 = @repository.changesets.find_by_revision('19')
208 cs3 = @repository.changesets.find_by_revision('19')
209 c3 = cs3.changes
209 c3 = cs3.changes
210 assert_equal 1, c3.size
210 assert_equal 1, c3.size
211 assert_equal 'A', c3[0].action
211 assert_equal 'A', c3[0].action
212 assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path
212 assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path
213 assert_equal "/latin-1-dir/test-#{@char_1}.txt", c3[0].from_path
213 assert_equal "/latin-1-dir/test-#{@char_1}.txt", c3[0].from_path
214 assert_equal '5d9891a1b425', c3[0].from_revision
214 assert_equal '5d9891a1b425', c3[0].from_revision
215 end
215 end
216
216
217 def test_find_changeset_by_name
217 def test_find_changeset_by_name
218 assert_equal 0, @repository.changesets.count
218 assert_equal 0, @repository.changesets.count
219 @repository.fetch_changesets
219 @repository.fetch_changesets
220 @project.reload
220 @project.reload
221 assert_equal NUM_REV, @repository.changesets.count
221 assert_equal NUM_REV, @repository.changesets.count
222 %w|2 400bb8672109 400|.each do |r|
222 %w|2 400bb8672109 400|.each do |r|
223 assert_equal '2', @repository.find_changeset_by_name(r).revision
223 assert_equal '2', @repository.find_changeset_by_name(r).revision
224 end
224 end
225 end
225 end
226
226
227 def test_find_changeset_by_invalid_name
227 def test_find_changeset_by_invalid_name
228 assert_equal 0, @repository.changesets.count
228 assert_equal 0, @repository.changesets.count
229 @repository.fetch_changesets
229 @repository.fetch_changesets
230 @project.reload
230 @project.reload
231 assert_equal NUM_REV, @repository.changesets.count
231 assert_equal NUM_REV, @repository.changesets.count
232 assert_nil @repository.find_changeset_by_name('100000')
232 assert_nil @repository.find_changeset_by_name('100000')
233 end
233 end
234
234
235 def test_identifier
235 def test_identifier
236 assert_equal 0, @repository.changesets.count
236 assert_equal 0, @repository.changesets.count
237 @repository.fetch_changesets
237 @repository.fetch_changesets
238 @project.reload
238 @project.reload
239 assert_equal NUM_REV, @repository.changesets.count
239 assert_equal NUM_REV, @repository.changesets.count
240 c = @repository.changesets.find_by_revision('2')
240 c = @repository.changesets.find_by_revision('2')
241 assert_equal c.scmid, c.identifier
241 assert_equal c.scmid, c.identifier
242 end
242 end
243
243
244 def test_format_identifier
244 def test_format_identifier
245 assert_equal 0, @repository.changesets.count
245 assert_equal 0, @repository.changesets.count
246 @repository.fetch_changesets
246 @repository.fetch_changesets
247 @project.reload
247 @project.reload
248 assert_equal NUM_REV, @repository.changesets.count
248 assert_equal NUM_REV, @repository.changesets.count
249 c = @repository.changesets.find_by_revision('2')
249 c = @repository.changesets.find_by_revision('2')
250 assert_equal '2:400bb8672109', c.format_identifier
250 assert_equal '2:400bb8672109', c.format_identifier
251 end
251 end
252
252
253 def test_find_changeset_by_empty_name
253 def test_find_changeset_by_empty_name
254 assert_equal 0, @repository.changesets.count
254 assert_equal 0, @repository.changesets.count
255 @repository.fetch_changesets
255 @repository.fetch_changesets
256 @project.reload
256 @project.reload
257 assert_equal NUM_REV, @repository.changesets.count
257 assert_equal NUM_REV, @repository.changesets.count
258 ['', ' ', nil].each do |r|
258 ['', ' ', nil].each do |r|
259 assert_nil @repository.find_changeset_by_name(r)
259 assert_nil @repository.find_changeset_by_name(r)
260 end
260 end
261 end
261 end
262
262
263 def test_activities
263 def test_activities
264 c = Changeset.new(:repository => @repository,
264 c = Changeset.new(:repository => @repository,
265 :committed_on => Time.now,
265 :committed_on => Time.now,
266 :revision => '123',
266 :revision => '123',
267 :scmid => 'abc400bb8672',
267 :scmid => 'abc400bb8672',
268 :comments => 'test')
268 :comments => 'test')
269 assert c.event_title.include?('123:abc400bb8672:')
269 assert c.event_title.include?('123:abc400bb8672:')
270 assert_equal 'abc400bb8672', c.event_url[:rev]
270 assert_equal 'abc400bb8672', c.event_url[:rev]
271 end
271 end
272
272
273 def test_previous
273 def test_previous
274 assert_equal 0, @repository.changesets.count
274 assert_equal 0, @repository.changesets.count
275 @repository.fetch_changesets
275 @repository.fetch_changesets
276 @project.reload
276 @project.reload
277 assert_equal NUM_REV, @repository.changesets.count
277 assert_equal NUM_REV, @repository.changesets.count
278 %w|28 3ae45e2d177d 3ae45|.each do |r1|
278 %w|28 3ae45e2d177d 3ae45|.each do |r1|
279 changeset = @repository.find_changeset_by_name(r1)
279 changeset = @repository.find_changeset_by_name(r1)
280 %w|27 7bbf4c738e71 7bbf|.each do |r2|
280 %w|27 7bbf4c738e71 7bbf|.each do |r2|
281 assert_equal @repository.find_changeset_by_name(r2), changeset.previous
281 assert_equal @repository.find_changeset_by_name(r2), changeset.previous
282 end
282 end
283 end
283 end
284 end
284 end
285
285
286 def test_previous_nil
286 def test_previous_nil
287 assert_equal 0, @repository.changesets.count
287 assert_equal 0, @repository.changesets.count
288 @repository.fetch_changesets
288 @repository.fetch_changesets
289 @project.reload
289 @project.reload
290 assert_equal NUM_REV, @repository.changesets.count
290 assert_equal NUM_REV, @repository.changesets.count
291 %w|0 0885933ad4f6 0885|.each do |r1|
291 %w|0 0885933ad4f6 0885|.each do |r1|
292 changeset = @repository.find_changeset_by_name(r1)
292 changeset = @repository.find_changeset_by_name(r1)
293 assert_nil changeset.previous
293 assert_nil changeset.previous
294 end
294 end
295 end
295 end
296
296
297 def test_next
297 def test_next
298 assert_equal 0, @repository.changesets.count
298 assert_equal 0, @repository.changesets.count
299 @repository.fetch_changesets
299 @repository.fetch_changesets
300 @project.reload
300 @project.reload
301 assert_equal NUM_REV, @repository.changesets.count
301 assert_equal NUM_REV, @repository.changesets.count
302 %w|27 7bbf4c738e71 7bbf|.each do |r2|
302 %w|27 7bbf4c738e71 7bbf|.each do |r2|
303 changeset = @repository.find_changeset_by_name(r2)
303 changeset = @repository.find_changeset_by_name(r2)
304 %w|28 3ae45e2d177d 3ae45|.each do |r1|
304 %w|28 3ae45e2d177d 3ae45|.each do |r1|
305 assert_equal @repository.find_changeset_by_name(r1), changeset.next
305 assert_equal @repository.find_changeset_by_name(r1), changeset.next
306 end
306 end
307 end
307 end
308 end
308 end
309
309
310 def test_next_nil
310 def test_next_nil
311 assert_equal 0, @repository.changesets.count
311 assert_equal 0, @repository.changesets.count
312 @repository.fetch_changesets
312 @repository.fetch_changesets
313 @project.reload
313 @project.reload
314 assert_equal NUM_REV, @repository.changesets.count
314 assert_equal NUM_REV, @repository.changesets.count
315 %w|28 3ae45e2d177d 3ae45|.each do |r1|
315 %w|28 3ae45e2d177d 3ae45|.each do |r1|
316 changeset = @repository.find_changeset_by_name(r1)
316 changeset = @repository.find_changeset_by_name(r1)
317 assert_nil changeset.next
317 assert_nil changeset.next
318 end
318 end
319 end
319 end
320 else
320 else
321 puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
321 puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
322 def test_fake; assert true end
322 def test_fake; assert true end
323 end
323 end
324 end
324 end
General Comments 0
You need to be logged in to leave comments. Login now