ohloh_scm 4.0.5 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -3
- data/.ruby-version +1 -1
- data/Dockerfile +8 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +48 -33
- data/lib/ohloh_scm/activity.rb +1 -1
- data/lib/ohloh_scm/bzr/activity.rb +12 -12
- data/lib/ohloh_scm/bzr/validation.rb +1 -1
- data/lib/ohloh_scm/commit.rb +2 -4
- data/lib/ohloh_scm/core.rb +2 -1
- data/lib/ohloh_scm/cvs/activity.rb +74 -60
- data/lib/ohloh_scm/cvs/scm.rb +12 -12
- data/lib/ohloh_scm/cvs/status.rb +1 -1
- data/lib/ohloh_scm/cvs/validation.rb +3 -3
- data/lib/ohloh_scm/diff.rb +1 -1
- data/lib/ohloh_scm/factory.rb +7 -1
- data/lib/ohloh_scm/git/activity.rb +111 -55
- data/lib/ohloh_scm/git/scm.rb +6 -8
- data/lib/ohloh_scm/git/status.rb +1 -1
- data/lib/ohloh_scm/git/validation.rb +1 -1
- data/lib/ohloh_scm/git_svn/activity.rb +5 -5
- data/lib/ohloh_scm/git_svn/scm.rb +5 -5
- data/lib/ohloh_scm/hg/activity.rb +13 -13
- data/lib/ohloh_scm/hg/scm.rb +3 -3
- data/lib/ohloh_scm/hg/validation.rb +1 -1
- data/lib/ohloh_scm/parser/branch_number.rb +7 -6
- data/lib/ohloh_scm/parser/bzr_xml_parser.rb +15 -15
- data/lib/ohloh_scm/parser/cvs_parser.rb +7 -6
- data/lib/ohloh_scm/parser/git_parser.rb +18 -15
- data/lib/ohloh_scm/parser/hg_parser.rb +8 -6
- data/lib/ohloh_scm/parser/svn_parser.rb +7 -6
- data/lib/ohloh_scm/py_bridge/hg_client.rb +1 -1
- data/lib/ohloh_scm/svn/activity.rb +17 -18
- data/lib/ohloh_scm/svn/scm.rb +4 -6
- data/lib/ohloh_scm/svn/validation.rb +2 -2
- data/lib/ohloh_scm/system.rb +1 -1
- data/lib/ohloh_scm/validation.rb +2 -4
- data/lib/ohloh_scm/version.rb +1 -1
- data/ohloh_scm.gemspec +5 -5
- data/spec/.rubocop.yml +2 -5
- data/spec/benchmarks/process_spawn_benchmark.rb +1 -1
- data/spec/helpers/assert_scm_attr_helper.rb +4 -4
- data/spec/helpers/generic_helper.rb +2 -2
- data/spec/helpers/repository_helper.rb +1 -1
- data/spec/ohloh_scm/activity_spec.rb +2 -2
- data/spec/ohloh_scm/bzr/activity_spec.rb +60 -60
- data/spec/ohloh_scm/bzr/validation_spec.rb +1 -1
- data/spec/ohloh_scm/cvs/activity_spec.rb +20 -21
- data/spec/ohloh_scm/cvs/scm_spec.rb +36 -36
- data/spec/ohloh_scm/cvs/validation_spec.rb +4 -4
- data/spec/ohloh_scm/factory_spec.rb +2 -2
- data/spec/ohloh_scm/git/activity_spec.rb +111 -110
- data/spec/ohloh_scm/git/scm_spec.rb +11 -11
- data/spec/ohloh_scm/git/status_spec.rb +3 -3
- data/spec/ohloh_scm/git/validation_spec.rb +7 -7
- data/spec/ohloh_scm/git_svn/activity_spec.rb +14 -14
- data/spec/ohloh_scm/git_svn/scm_spec.rb +1 -1
- data/spec/ohloh_scm/hg/activity_spec.rb +99 -99
- data/spec/ohloh_scm/hg/scm_spec.rb +5 -5
- data/spec/ohloh_scm/hg/validation_spec.rb +1 -1
- data/spec/ohloh_scm/parser/array_writer_spec.rb +7 -7
- data/spec/ohloh_scm/parser/branch_number_spec.rb +3 -3
- data/spec/ohloh_scm/parser/cvs_parser_spec.rb +31 -31
- data/spec/ohloh_scm/parser/git_parser_spec.rb +29 -32
- data/spec/ohloh_scm/parser/hg_parser_spec.rb +60 -60
- data/spec/ohloh_scm/svn/activity_spec.rb +11 -12
- data/spec/ohloh_scm/svn/scm_spec.rb +24 -24
- data/spec/ohloh_scm/svn/validation_spec.rb +6 -6
- data/spec/ohloh_scm/svn_parser_spec.rb +29 -29
- data/spec/ohloh_scm/system_spec.rb +5 -5
- data/spec/ohloh_scm/version_spec.rb +1 -1
- data/spec/string_encoder_spec.rb +4 -4
- metadata +5 -79
@@ -8,7 +8,7 @@ describe 'Bzr::Activity' do
|
|
8
8
|
tmpdir do |dir|
|
9
9
|
bzr.activity.export(dir)
|
10
10
|
entries = ['.', '..', 'Cédric.txt', 'file1.txt', 'file3.txt', 'file4.txt', 'file5.txt']
|
11
|
-
Dir.entries(dir).sort
|
11
|
+
assert_equal Dir.entries(dir).sort, entries
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -17,11 +17,11 @@ describe 'Bzr::Activity' do
|
|
17
17
|
with_bzr_repository('bzr') do |bzr|
|
18
18
|
activity = bzr.activity
|
19
19
|
|
20
|
-
activity.head_token
|
21
|
-
activity.head.token
|
20
|
+
assert_equal activity.head_token, 'test@example.com-20111222183733-y91if5npo3pe8ifs'
|
21
|
+
assert_equal activity.head.token, 'test@example.com-20111222183733-y91if5npo3pe8ifs'
|
22
22
|
assert activity.head.diffs.any? # diffs should be populated
|
23
23
|
|
24
|
-
activity.parents(activity.head).first.token
|
24
|
+
assert_equal activity.parents(activity.head).first.token, 'obnox@samba.org-20090204004942-73rnw0izen42f154'
|
25
25
|
assert activity.parents(activity.head).first.diffs.any?
|
26
26
|
end
|
27
27
|
end
|
@@ -35,11 +35,11 @@ describe 'Bzr::Activity' do
|
|
35
35
|
|
36
36
|
commit = OhlohScm::Commit.new(token: 6)
|
37
37
|
diff = OhlohScm::Diff.new(path: 'file1.txt')
|
38
|
-
bzr.activity.cat_file(commit, diff)
|
38
|
+
assert_equal bzr.activity.cat_file(commit, diff), expected
|
39
39
|
|
40
40
|
# file2.txt has been removed in commit #5
|
41
41
|
diff2 = OhlohScm::Diff.new(path: 'file2.txt')
|
42
|
-
bzr.activity.cat_file(bzr.activity.commits.last, diff2)
|
42
|
+
assert_nil bzr.activity.cat_file(bzr.activity.commits.last, diff2)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -52,7 +52,7 @@ describe 'Bzr::Activity' do
|
|
52
52
|
|
53
53
|
commit = OhlohScm::Commit.new(token: 7)
|
54
54
|
diff = OhlohScm::Diff.new(path: 'Cédric.txt')
|
55
|
-
bzr.activity.cat_file(commit, diff)
|
55
|
+
assert_equal bzr.activity.cat_file(commit, diff), expected
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -65,7 +65,7 @@ describe 'Bzr::Activity' do
|
|
65
65
|
|
66
66
|
commit = OhlohScm::Commit.new(token: 6)
|
67
67
|
diff = OhlohScm::Diff.new(path: 'file1.txt')
|
68
|
-
bzr.activity.cat_file_parent(commit, diff)
|
68
|
+
assert_equal bzr.activity.cat_file_parent(commit, diff), expected
|
69
69
|
|
70
70
|
# file2.txt has been removed in commit #5
|
71
71
|
expected = <<-EXPECTED.gsub(/ {8}/, '')
|
@@ -74,24 +74,24 @@ describe 'Bzr::Activity' do
|
|
74
74
|
|
75
75
|
commit2 = OhlohScm::Commit.new(token: 5)
|
76
76
|
diff2 = OhlohScm::Diff.new(path: 'file2.txt')
|
77
|
-
bzr.activity.cat_file_parent(commit2, diff2)
|
77
|
+
assert_equal bzr.activity.cat_file_parent(commit2, diff2), expected
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe 'commits' do
|
82
82
|
it 'must test_commit_count' do
|
83
83
|
with_bzr_repository('bzr') do |bzr|
|
84
|
-
bzr.activity.commit_count
|
85
|
-
bzr.activity.commit_count(after: revision_ids.first)
|
86
|
-
bzr.activity.commit_count(after: revision_ids[5])
|
87
|
-
bzr.activity.commit_count(after: revision_ids.last)
|
84
|
+
assert_equal bzr.activity.commit_count, 7
|
85
|
+
assert_equal bzr.activity.commit_count(after: revision_ids.first), 6
|
86
|
+
assert_equal bzr.activity.commit_count(after: revision_ids[5]), 1
|
87
|
+
assert_equal bzr.activity.commit_count(after: revision_ids.last), 0
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'must test_commit_count_with_branches' do
|
92
92
|
with_bzr_repository('bzr_with_branch') do |bzr|
|
93
93
|
# Only 3 commits are on main line... make sure we catch the branch commit as well
|
94
|
-
bzr.activity.commit_count
|
94
|
+
assert_equal bzr.activity.commit_count, 4
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -105,16 +105,16 @@ describe 'Bzr::Activity' do
|
|
105
105
|
it 'must test_commit_count_trunk_only' do
|
106
106
|
with_bzr_repository('bzr_with_branch') do |bzr|
|
107
107
|
# Only 3 commits are on main line
|
108
|
-
bzr.activity.commit_count(trunk_only: true)
|
108
|
+
assert_equal bzr.activity.commit_count(trunk_only: true), 3
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'must test_commit_tokens_after' do
|
113
113
|
with_bzr_repository('bzr') do |bzr|
|
114
|
-
bzr.activity.commit_tokens
|
115
|
-
bzr.activity.commit_tokens(after: revision_ids.first)
|
116
|
-
bzr.activity.commit_tokens(after: revision_ids[5])
|
117
|
-
bzr.activity.commit_tokens(after: revision_ids.last)
|
114
|
+
assert_equal bzr.activity.commit_tokens, revision_ids
|
115
|
+
assert_equal bzr.activity.commit_tokens(after: revision_ids.first), revision_ids[1..6]
|
116
|
+
assert_equal bzr.activity.commit_tokens(after: revision_ids[5]), revision_ids[6..6]
|
117
|
+
assert_equal bzr.activity.commit_tokens(after: revision_ids.last), []
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -140,7 +140,7 @@ describe 'Bzr::Activity' do
|
|
140
140
|
'test@example.com-20090206214451-lzjngefdyw3vmgms',
|
141
141
|
'test@example.com-20090206214350-rqhdpz92l11eoq2t', # branch commit
|
142
142
|
'test@example.com-20090206214515-21lkfj3dbocao5pr'] # merge commit
|
143
|
-
bzr.activity.commit_tokens
|
143
|
+
assert_equal bzr.activity.commit_tokens, expected
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
@@ -149,7 +149,7 @@ describe 'Bzr::Activity' do
|
|
149
149
|
expected = ['test@example.com-20090206214301-s93cethy9atcqu9h',
|
150
150
|
'test@example.com-20090206214451-lzjngefdyw3vmgms',
|
151
151
|
'test@example.com-20090206214515-21lkfj3dbocao5pr'] # merge commit
|
152
|
-
bzr.activity.commit_tokens(trunk_only: true)
|
152
|
+
assert_equal bzr.activity.commit_tokens(trunk_only: true), expected
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -167,7 +167,7 @@ describe 'Bzr::Activity' do
|
|
167
167
|
'test@example.com-20110803170522-asv6i9z6m22jc8zz',
|
168
168
|
'test@example.com-20110803170648-o0xcbni7lwp97azj',
|
169
169
|
'test@example.com-20110803170818-v44umypquqg8migo']
|
170
|
-
bzr.activity.commit_tokens
|
170
|
+
assert_equal bzr.activity.commit_tokens, expected
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
@@ -180,7 +180,7 @@ describe 'Bzr::Activity' do
|
|
180
180
|
'obnox@samba.org-20090204002540-gmana8tk5f9gboq9',
|
181
181
|
'obnox@samba.org-20090204004942-73rnw0izen42f154',
|
182
182
|
'test@example.com-20110803170818-v44umypquqg8migo']
|
183
|
-
bzr.activity.commit_tokens(trunk_only: true)
|
183
|
+
assert_equal bzr.activity.commit_tokens(trunk_only: true), expected
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
@@ -191,7 +191,7 @@ describe 'Bzr::Activity' do
|
|
191
191
|
'test@example.com-20090206214350-rqhdpz92l11eoq2t', # branch commit
|
192
192
|
'test@example.com-20090206214515-21lkfj3dbocao5pr'] # merge commit
|
193
193
|
|
194
|
-
bzr.activity.commits.map(&:token)
|
194
|
+
assert_equal bzr.activity.commits.map(&:token), expected
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -200,21 +200,21 @@ describe 'Bzr::Activity' do
|
|
200
200
|
expected = ['test@example.com-20090206214301-s93cethy9atcqu9h',
|
201
201
|
'test@example.com-20090206214451-lzjngefdyw3vmgms',
|
202
202
|
'test@example.com-20090206214515-21lkfj3dbocao5pr'] # merge commit
|
203
|
-
bzr.activity.commits(trunk_only: true).map(&:token)
|
203
|
+
assert_equal bzr.activity.commits(trunk_only: true).map(&:token), expected
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
207
|
it 'must test_commits_after_merge' do
|
208
208
|
with_bzr_repository('bzr_with_branch') do |bzr|
|
209
209
|
last_commit = bzr.activity.commits.last
|
210
|
-
bzr.activity.commits(after: last_commit.token)
|
210
|
+
assert_predicate bzr.activity.commits(after: last_commit.token), :empty?
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'must test_commits_after_nested_merge' do
|
215
215
|
with_bzr_repository('bzr_with_nested_branches') do |bzr|
|
216
216
|
last_commit = bzr.activity.commits.last
|
217
|
-
bzr.activity.commits(after: last_commit.token)
|
217
|
+
assert_predicate bzr.activity.commits(after: last_commit.token), :empty?
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
@@ -232,7 +232,7 @@ describe 'Bzr::Activity' do
|
|
232
232
|
'test@example.com-20110803170522-asv6i9z6m22jc8zz',
|
233
233
|
'test@example.com-20110803170648-o0xcbni7lwp97azj',
|
234
234
|
'test@example.com-20110803170818-v44umypquqg8migo']
|
235
|
-
bzr.activity.commits.map(&:token)
|
235
|
+
assert_equal bzr.activity.commits.map(&:token), expected
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
@@ -245,18 +245,18 @@ describe 'Bzr::Activity' do
|
|
245
245
|
'obnox@samba.org-20090204002540-gmana8tk5f9gboq9',
|
246
246
|
'obnox@samba.org-20090204004942-73rnw0izen42f154',
|
247
247
|
'test@example.com-20110803170818-v44umypquqg8migo']
|
248
|
-
bzr.activity.commits(trunk_only: true).map(&:token)
|
248
|
+
assert_equal bzr.activity.commits(trunk_only: true).map(&:token), expected
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
252
|
it 'must test_commits' do
|
253
253
|
with_bzr_repository('bzr') do |bzr|
|
254
|
-
bzr.activity.commits.collect(&:token)
|
255
|
-
bzr.activity.commits(after: revision_ids[5]).collect(&:token)
|
256
|
-
bzr.activity.commits(after: revision_ids.last).collect(&:token)
|
254
|
+
assert_equal bzr.activity.commits.collect(&:token), revision_ids
|
255
|
+
assert_equal bzr.activity.commits(after: revision_ids[5]).collect(&:token), revision_ids[6..6]
|
256
|
+
assert_equal bzr.activity.commits(after: revision_ids.last).collect(&:token), []
|
257
257
|
|
258
258
|
# Check that the diffs are not populated
|
259
|
-
bzr.activity.commits.first.diffs
|
259
|
+
assert_equal bzr.activity.commits.first.diffs, []
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
@@ -280,7 +280,7 @@ describe 'Bzr::Activity' do
|
|
280
280
|
assert !FileTest.exist?(bzr.activity.log_filename)
|
281
281
|
|
282
282
|
# Verify that we got the commits in forward chronological order
|
283
|
-
commits.collect(&:token)
|
283
|
+
assert_equal commits.collect(&:token), revision_ids
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
@@ -292,7 +292,7 @@ describe 'Bzr::Activity' do
|
|
292
292
|
'test@example.com-20090206214451-lzjngefdyw3vmgms',
|
293
293
|
'test@example.com-20090206214350-rqhdpz92l11eoq2t', # branch commit
|
294
294
|
'test@example.com-20090206214515-21lkfj3dbocao5pr'] # merge commit]
|
295
|
-
commits.map(&:token)
|
295
|
+
assert_equal commits.map(&:token), expected
|
296
296
|
end
|
297
297
|
end
|
298
298
|
|
@@ -306,7 +306,7 @@ describe 'Bzr::Activity' do
|
|
306
306
|
'test@example.com-20090206214515-21lkfj3dbocao5pr' # merge commit
|
307
307
|
# 'test@example.com-20090206214350-rqhdpz92l11eoq2t' # branch commit -- after merge!
|
308
308
|
]
|
309
|
-
commits.map(&:token)
|
309
|
+
assert_equal commits.map(&:token), expected
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
@@ -316,7 +316,7 @@ describe 'Bzr::Activity' do
|
|
316
316
|
|
317
317
|
commits = []
|
318
318
|
bzr.activity.each_commit(after: last_commit.token) { |c| commits << c }
|
319
|
-
commits
|
319
|
+
assert_equal commits, []
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
@@ -326,7 +326,7 @@ describe 'Bzr::Activity' do
|
|
326
326
|
|
327
327
|
commits = []
|
328
328
|
bzr.activity.each_commit(after: last_commit.token) { |c| commits << c }
|
329
|
-
commits
|
329
|
+
assert_equal commits, []
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
@@ -337,7 +337,7 @@ describe 'Bzr::Activity' do
|
|
337
337
|
|
338
338
|
yielded_commits = []
|
339
339
|
bzr.activity.each_commit(after: next_to_last_commit.token) { |c| yielded_commits << c }
|
340
|
-
yielded_commits.map(&:token)
|
340
|
+
assert_equal yielded_commits.map(&:token), [last_commit.token]
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
@@ -357,7 +357,7 @@ describe 'Bzr::Activity' do
|
|
357
357
|
'test@example.com-20110803170522-asv6i9z6m22jc8zz',
|
358
358
|
'test@example.com-20110803170648-o0xcbni7lwp97azj',
|
359
359
|
'test@example.com-20110803170818-v44umypquqg8migo']
|
360
|
-
commits.map(&:token)
|
360
|
+
assert_equal commits.map(&:token), expected
|
361
361
|
end
|
362
362
|
end
|
363
363
|
|
@@ -372,7 +372,7 @@ describe 'Bzr::Activity' do
|
|
372
372
|
'obnox@samba.org-20090204002540-gmana8tk5f9gboq9',
|
373
373
|
'obnox@samba.org-20090204004942-73rnw0izen42f154',
|
374
374
|
'test@example.com-20110803170818-v44umypquqg8migo']
|
375
|
-
commits.map(&:token)
|
375
|
+
assert_equal commits.map(&:token), expected
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
@@ -387,16 +387,16 @@ describe 'Bzr::Activity' do
|
|
387
387
|
bzr.activity.each_commit do |c|
|
388
388
|
commits << c
|
389
389
|
end
|
390
|
-
commits.size
|
391
|
-
commits.first.diffs.size
|
392
|
-
commits.first.diffs.first.path
|
390
|
+
assert_equal commits.size, 1
|
391
|
+
assert_equal commits.first.diffs.size, 1
|
392
|
+
assert_equal commits.first.diffs.first.path, 'foo/helloworld.c'
|
393
393
|
end
|
394
394
|
end
|
395
395
|
|
396
396
|
# Verfies OTWO-344
|
397
397
|
it 'must test_commit_tokens_with_colon_character' do
|
398
398
|
with_bzr_repository('bzr_colon') do |bzr|
|
399
|
-
bzr.activity.commit_tokens
|
399
|
+
assert_equal bzr.activity.commit_tokens, ['svn-v4:364a429a-ab12-11de-804f-e3d9c25ff3d2::0']
|
400
400
|
end
|
401
401
|
end
|
402
402
|
|
@@ -406,23 +406,23 @@ describe 'Bzr::Activity' do
|
|
406
406
|
bzr.activity.each_commit do |c|
|
407
407
|
commits << c
|
408
408
|
end
|
409
|
-
commits.size
|
409
|
+
assert_equal commits.size, 3
|
410
410
|
|
411
|
-
commits[0].message
|
412
|
-
commits[0].committer_name
|
413
|
-
commits[0].author_name
|
414
|
-
commits[0].author_email
|
411
|
+
assert_equal commits[0].message, 'Initial.'
|
412
|
+
assert_equal commits[0].committer_name, 'Abhay Mujumdar'
|
413
|
+
assert_nil commits[0].author_name
|
414
|
+
assert_nil commits[0].author_email
|
415
415
|
|
416
|
-
commits[1].message
|
417
|
-
commits[1].committer_name
|
418
|
-
commits[1].author_name
|
419
|
-
commits[1].author_email
|
416
|
+
assert_equal commits[1].message, 'Updated.'
|
417
|
+
assert_equal commits[1].committer_name, 'Abhay Mujumdar'
|
418
|
+
assert_equal commits[1].author_name, 'John Doe'
|
419
|
+
assert_equal commits[1].author_email, 'johndoe@example.com'
|
420
420
|
|
421
421
|
# When there are multiple authors, first one is captured.
|
422
|
-
commits[2].message
|
423
|
-
commits[2].committer_name
|
424
|
-
commits[2].author_name
|
425
|
-
commits[2].author_email
|
422
|
+
assert_equal commits[2].message, 'Updated by two authors.'
|
423
|
+
assert_equal commits[2].committer_name, 'test'
|
424
|
+
assert_equal commits[2].author_name, 'John Doe'
|
425
|
+
assert_equal commits[2].author_email, 'johndoe@example.com'
|
426
426
|
end
|
427
427
|
end
|
428
428
|
|
@@ -453,8 +453,8 @@ describe 'Bzr::Activity' do
|
|
453
453
|
time2 = Time.parse('2011-12-22 18:37:33 +0000')
|
454
454
|
time3 = Time.parse('2009-02-04 00:24:22 +0000')
|
455
455
|
|
456
|
-
bzr.activity.tags
|
457
|
-
|
456
|
+
assert_equal bzr.activity.tags, [['v1.0.0', '5', time1],
|
457
|
+
['v2.0.0', '7', time2], ['v 3.0.0', '2', time3]]
|
458
458
|
end
|
459
459
|
end
|
460
460
|
end
|
@@ -6,23 +6,23 @@ describe 'Cvs::Activity' do
|
|
6
6
|
it 'must return the host' do
|
7
7
|
activity = get_core(:cvs, url: ':ext:anonymous:@moodle.cvs.sourceforge.net:/cvsroot/moodle',
|
8
8
|
branch_name: 'contrib').activity
|
9
|
-
activity.send(:host)
|
9
|
+
assert_equal activity.send(:host), 'moodle.cvs.sourceforge.net'
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'must return the protocol' do
|
13
13
|
activity = get_core(:cvs, url: ':pserver:foo:@foo.com:/cvsroot/a', branch_name: 'b').activity
|
14
|
-
activity.send(:protocol)
|
14
|
+
assert_equal activity.send(:protocol), :pserver
|
15
15
|
|
16
16
|
activity = get_core(:cvs, url: ':ext:foo:@foo.com:/cvsroot/a', branch_name: 'b').activity
|
17
|
-
activity.send(:protocol)
|
17
|
+
assert_equal activity.send(:protocol), :ext
|
18
18
|
|
19
19
|
activity = get_core(:cvs, url: ':pserver:ext:@foo.com:/cvsroot/a', branch_name: 'b').activity
|
20
|
-
activity.send(:protocol)
|
20
|
+
assert_equal activity.send(:protocol), :pserver
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must test tags' do
|
24
24
|
with_cvs_repository('cvs', 'simple') do |cvs|
|
25
|
-
cvs.activity.tags
|
25
|
+
assert_equal cvs.activity.tags, [['simple_release_tag', '1.1.1.1'], ['simple_vendor_tag', '1.1.1']]
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -30,29 +30,28 @@ describe 'Cvs::Activity' do
|
|
30
30
|
with_cvs_repository('cvs', 'simple') do |cvs|
|
31
31
|
Dir.mktmpdir('oh_scm_tag_') do |dir|
|
32
32
|
cvs.activity.export_tag(dir, 'simple_release_tag')
|
33
|
-
Dir.entries(dir).sort
|
33
|
+
assert_equal Dir.entries(dir).sort, ['.', '..', 'foo.rb']
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'must test commits' do
|
39
39
|
with_cvs_repository('cvs', 'simple') do |cvs|
|
40
|
-
cvs.activity.commits.collect(&:token)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
assert_equal cvs.activity.commits.collect(&:token), ['2006-06-29 16:21:07',
|
41
|
+
'2006-06-29 18:14:47',
|
42
|
+
'2006-06-29 18:45:29',
|
43
|
+
'2006-06-29 18:48:54',
|
44
|
+
'2006-06-29 18:52:23']
|
45
45
|
|
46
46
|
# Make sure we are date format agnostic (2008/01/01 is the same as 2008-01-01)
|
47
|
-
cvs.activity.commits(after: '2006/06/29 18:45:29').collect(&:token)
|
48
|
-
|
49
|
-
'2006-06-29 18:52:23']
|
47
|
+
assert_equal cvs.activity.commits(after: '2006/06/29 18:45:29').collect(&:token),
|
48
|
+
['2006-06-29 18:48:54', '2006-06-29 18:52:23']
|
50
49
|
|
51
|
-
cvs.activity.commits(after: '2006-06-29 18:45:29')
|
52
|
-
|
53
|
-
|
50
|
+
assert_equal cvs.activity.commits(after: '2006-06-29 18:45:29')
|
51
|
+
.collect(&:token), ['2006-06-29 18:48:54',
|
52
|
+
'2006-06-29 18:52:23']
|
54
53
|
|
55
|
-
cvs.activity.commits(after: '2006/06/29 18:52:23').collect(&:token)
|
54
|
+
assert_empty cvs.activity.commits(after: '2006/06/29 18:52:23').collect(&:token)
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
@@ -64,7 +63,7 @@ describe 'Cvs::Activity' do
|
|
64
63
|
utc_dates = ['2006-06-29 16:21:07 UTC', '2006-06-29 18:14:47 UTC',
|
65
64
|
'2006-06-29 18:45:29 UTC', '2006-06-29 18:48:54 UTC',
|
66
65
|
'2006-06-29 18:52:23 UTC']
|
67
|
-
git_core.activity.commits.map(&:author_date).map(&:to_s)
|
66
|
+
assert_equal git_core.activity.commits.map(&:author_date).map(&:to_s), utc_dates
|
68
67
|
end
|
69
68
|
end
|
70
69
|
end
|
@@ -72,7 +71,7 @@ describe 'Cvs::Activity' do
|
|
72
71
|
it 'must test commits sets scm' do
|
73
72
|
with_cvs_repository('cvs', 'simple') do |cvs|
|
74
73
|
cvs.activity.commits.each do |c|
|
75
|
-
cvs.activity.scm
|
74
|
+
assert_equal cvs.activity.scm, c.scm
|
76
75
|
end
|
77
76
|
end
|
78
77
|
end
|
@@ -80,7 +79,7 @@ describe 'Cvs::Activity' do
|
|
80
79
|
it 'must test open log file encoding' do
|
81
80
|
with_cvs_repository('cvs', 'invalid_utf8') do |cvs|
|
82
81
|
cvs.activity.send(:open_log_file) do |io|
|
83
|
-
io.read.valid_encoding
|
82
|
+
assert_equal io.read.valid_encoding?, true
|
84
83
|
end
|
85
84
|
end
|
86
85
|
end
|
@@ -4,109 +4,109 @@ describe 'Cvs::Scm' do
|
|
4
4
|
it 'must test symlink fixup' do
|
5
5
|
scm = get_core(:cvs, url: ':pserver:anoncvs:@cvs.netbeans.org:/cvs').scm
|
6
6
|
scm.normalize
|
7
|
-
scm.url
|
7
|
+
assert_equal scm.url, ':pserver:anoncvs:@cvs.netbeans.org:/shared/data/ccvs/repository'
|
8
8
|
|
9
9
|
scm = get_core(:cvs, url: ':pserver:anoncvs:@cvs.dev.java.net:/cvs').scm
|
10
10
|
scm.normalize
|
11
|
-
scm.url
|
11
|
+
assert_equal scm.url, ':pserver:anoncvs:@cvs.dev.java.net:/shared/data/ccvs/repository'
|
12
12
|
|
13
13
|
scm = get_core(:cvs, url: ':PSERVER:ANONCVS:@CVS.DEV.JAVA.NET:/cvs').scm
|
14
14
|
scm.normalize
|
15
|
-
scm.url
|
15
|
+
assert_equal scm.url, ':PSERVER:ANONCVS:@CVS.DEV.JAVA.NET:/shared/data/ccvs/repository'
|
16
16
|
|
17
17
|
scm = get_core(:cvs, url: ':pserver:anonymous:@cvs.gna.org:/cvs/eagleusb').scm
|
18
18
|
scm.normalize
|
19
|
-
scm.url
|
19
|
+
assert_equal scm.url, ':pserver:anonymous:@cvs.gna.org:/var/cvs/eagleusb'
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'must test sync_pserver_username_password' do
|
23
23
|
# Pull username only from url
|
24
24
|
scm = get_core(:cvs, url: ':pserver:guest:@ohloh.net:/test').scm
|
25
25
|
scm.normalize
|
26
|
-
scm.url
|
27
|
-
scm.username
|
28
|
-
scm.password
|
26
|
+
assert_equal scm.url, ':pserver:guest:@ohloh.net:/test'
|
27
|
+
assert_equal scm.username, 'guest'
|
28
|
+
assert_equal scm.password, ''
|
29
29
|
|
30
30
|
# Pull username and password from url
|
31
31
|
scm = get_core(:cvs, url: ':pserver:guest:secret@ohloh.net:/test').scm
|
32
32
|
scm.normalize
|
33
33
|
|
34
|
-
scm.url
|
35
|
-
scm.username
|
36
|
-
scm.password
|
34
|
+
assert_equal scm.url, ':pserver:guest:secret@ohloh.net:/test'
|
35
|
+
assert_equal scm.username, 'guest'
|
36
|
+
assert_equal scm.password, 'secret'
|
37
37
|
|
38
38
|
# Apply username and password to url
|
39
39
|
scm = get_core(:cvs, url: ':pserver::@ohloh.net:/test', username: 'guest', password: 'secret').scm
|
40
40
|
scm.normalize
|
41
|
-
scm.url
|
42
|
-
scm.username
|
43
|
-
scm.password
|
41
|
+
assert_equal scm.url, ':pserver:guest:secret@ohloh.net:/test'
|
42
|
+
assert_equal scm.username, 'guest'
|
43
|
+
assert_equal scm.password, 'secret'
|
44
44
|
|
45
45
|
# Passwords disagree, use :password attribute
|
46
46
|
scm = get_core(:cvs, url: ':pserver:guest:old@ohloh.net:/test', username: 'guest', password: 'new').scm
|
47
47
|
scm.normalize
|
48
|
-
scm.url
|
49
|
-
scm.username
|
50
|
-
scm.password
|
48
|
+
assert_equal scm.url, ':pserver:guest:new@ohloh.net:/test'
|
49
|
+
assert_equal scm.username, 'guest'
|
50
|
+
assert_equal scm.password, 'new'
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'must test guess_forge' do
|
54
54
|
scm = get_core(:cvs, url: nil).scm
|
55
|
-
scm.send(:guess_forge)
|
55
|
+
assert_nil scm.send(:guess_forge)
|
56
56
|
|
57
57
|
scm = get_core(:cvs, url: 'garbage_in_garbage_out').scm
|
58
|
-
scm.send(:guess_forge)
|
58
|
+
assert_nil scm.send(:guess_forge)
|
59
59
|
|
60
60
|
scm = get_core(:cvs, url: ':pserver:anonymous:@boost.cvs.sourceforge.net:/cvsroot/boost').scm
|
61
|
-
scm.send(:guess_forge)
|
61
|
+
assert_equal scm.send(:guess_forge), 'sourceforge.net'
|
62
62
|
|
63
63
|
scm = get_core(:cvs, url: ':pserver:guest:@cvs.dev.java.net:/cvs').scm
|
64
|
-
scm.send(:guess_forge)
|
64
|
+
assert_equal scm.send(:guess_forge), 'java.net'
|
65
65
|
|
66
66
|
scm = get_core(:cvs, url: ':PSERVER:ANONCVS:@CVS.DEV.JAVA.NET:/cvs').scm
|
67
|
-
scm.send(:guess_forge)
|
67
|
+
assert_equal scm.send(:guess_forge), 'java.net'
|
68
68
|
|
69
69
|
scm = get_core(:cvs, url: ':pserver:guest:@colorchooser.dev.java.net:/cvs').scm
|
70
|
-
scm.send(:guess_forge)
|
70
|
+
assert_equal scm.send(:guess_forge), 'java.net'
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'must test local directory trim' do
|
74
74
|
scm = get_core(:cvs, url: '/Users/robin/cvs_repo/', branch_name: 'simple').scm
|
75
|
-
scm.send(:trim_directory, '/Users/robin/cvs_repo/simple/foo.rb')
|
75
|
+
assert_equal scm.send(:trim_directory, '/Users/robin/cvs_repo/simple/foo.rb'), '/Users/robin/cvs_repo/simple/foo.rb'
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'must test remote directory trim' do
|
79
79
|
scm = get_core(:cvs, url: ':pserver:anonymous:@moodle.cvs.sourceforge.net:/cvsroot/moodle',
|
80
80
|
branch_name: 'contrib').scm
|
81
|
-
scm.send(:trim_directory, '/cvsroot/moodle/contrib/foo.rb')
|
81
|
+
assert_equal scm.send(:trim_directory, '/cvsroot/moodle/contrib/foo.rb'), 'foo.rb'
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'must test remote directory trim with port number' do
|
85
85
|
scm = get_core(:cvs, url: ':pserver:anoncvs:anoncvs@libvirt.org:2401/data/cvs', branch_name: 'libvirt').scm
|
86
|
-
scm.send(:trim_directory, '/data/cvs/libvirt/docs/html/Attic')
|
86
|
+
assert_equal scm.send(:trim_directory, '/data/cvs/libvirt/docs/html/Attic'), 'docs/html/Attic'
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'must test ordered directory list' do
|
90
90
|
scm = get_core(:cvs, url: ':pserver:anonymous:@moodle.cvs.sourceforge.net:/cvsroot/moodle',
|
91
91
|
branch_name: 'contrib').scm
|
92
92
|
|
93
|
-
list = scm.send(:build_ordered_directory_list, [
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
list.size
|
98
|
-
list
|
93
|
+
list = scm.send(:build_ordered_directory_list, %i[/cvsroot/moodle/contrib/foo/bar
|
94
|
+
/cvsroot/moodle/contrib
|
95
|
+
/cvsroot/moodle/contrib/hello
|
96
|
+
/cvsroot/moodle/contrib/hello])
|
97
|
+
assert_equal list.size, 4
|
98
|
+
assert_equal list, ['', 'foo', 'hello', 'foo/bar']
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'must test ordered directory list ignores Attic' do
|
102
102
|
scm = get_core(:cvs, url: ':pserver:anonymous:@moodle.cvs.sourceforge.net:/cvsroot/moodle',
|
103
103
|
branch_name: 'contrib').scm
|
104
104
|
|
105
|
-
list = scm.send(:build_ordered_directory_list, [
|
106
|
-
|
107
|
-
|
105
|
+
list = scm.send(:build_ordered_directory_list, %i[/cvsroot/moodle/contrib/foo/bar
|
106
|
+
/cvsroot/moodle/contrib/Attic
|
107
|
+
/cvsroot/moodle/contrib/hello/Attic])
|
108
108
|
|
109
|
-
list.size
|
110
|
-
list
|
109
|
+
assert_equal list.size, 4
|
110
|
+
assert_equal list, ['', 'foo', 'hello', 'foo/bar']
|
111
111
|
end
|
112
112
|
end
|
@@ -6,14 +6,14 @@ describe 'Cvs::Validation' do
|
|
6
6
|
url = ':pserver:anonymous:@foobar.xyz_example.org:/cvsroot'
|
7
7
|
core = OhlohScm::Factory.get_core(scm_type: :cvs, url: url, branch_name: 'foo')
|
8
8
|
core.validate
|
9
|
-
core.errors
|
9
|
+
refute_empty core.errors
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'must have errors for invalid branch_name' do
|
14
|
-
get_core(:cvs, branch_name: 'x' * 81).validation.send(:branch_name_errors)
|
15
|
-
get_core(:cvs, branch_name: 'x' * 201).validation.send(:branch_name_errors)
|
16
|
-
get_core(:cvs, branch_name: 'foo@bar').validation.send(:branch_name_errors)
|
14
|
+
assert_nil get_core(:cvs, branch_name: 'x' * 81).validation.send(:branch_name_errors)
|
15
|
+
refute_empty get_core(:cvs, branch_name: 'x' * 201).validation.send(:branch_name_errors)
|
16
|
+
refute_empty get_core(:cvs, branch_name: 'foo@bar').validation.send(:branch_name_errors)
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'must test rejected urls' do
|
@@ -7,8 +7,8 @@ describe 'Factory' do
|
|
7
7
|
url = 'https://foobar.git'
|
8
8
|
core = OhlohScm::Factory.get_core(scm_type: :git, url: url)
|
9
9
|
|
10
|
-
core.status.scm.
|
11
|
-
core.scm.url
|
10
|
+
assert core.status.scm.is_a?(OhlohScm::Git::Scm)
|
11
|
+
assert_equal core.scm.url, url
|
12
12
|
assert core.activity.method(:commits)
|
13
13
|
assert core.status.method(:exist?)
|
14
14
|
assert core.validation.method(:validate)
|