ohloh_scm 4.0.4 → 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 +5 -5
- 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 +4 -6
- data/lib/ohloh_scm/version.rb +1 -1
- data/ohloh_scm.gemspec +5 -5
- data/security.md +30 -0
- 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 +8 -81
@@ -4,8 +4,8 @@ describe 'Hg::Activity' do
|
|
4
4
|
it 'must fetch tags' do
|
5
5
|
with_hg_repository('hg') do |hg|
|
6
6
|
time = Time.parse('Mon Sep 19 15:27:19 2022 +0000')
|
7
|
-
hg.activity.tags.first
|
8
|
-
hg.activity.tags.last.first(2)
|
7
|
+
assert_equal hg.activity.tags.first, ['tip', '6', time]
|
8
|
+
assert_equal hg.activity.tags.last.first(2), ['tagname with space', '2']
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -14,7 +14,7 @@ describe 'Hg::Activity' do
|
|
14
14
|
Dir.mktmpdir do |dir|
|
15
15
|
hg.activity.export(dir)
|
16
16
|
entries = ['.', '..', '.hgtags', 'Gemfile.lock', 'Godeps', 'README', 'makefile', 'nested', 'two']
|
17
|
-
Dir.entries(dir).sort
|
17
|
+
assert_equal Dir.entries(dir).sort, entries
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -22,72 +22,72 @@ describe 'Hg::Activity' do
|
|
22
22
|
describe 'commits' do
|
23
23
|
it 'commit_count' do
|
24
24
|
with_hg_repository('hg') do |hg|
|
25
|
-
hg.activity.commit_count
|
26
|
-
hg.activity.commit_count(after: 'b14fa4692f949940bd1e28da6fb4617de2615484')
|
27
|
-
hg.activity.commit_count(after: '655f04cf6ad708ab58c7b941672dce09dd369a18')
|
25
|
+
assert_equal hg.activity.commit_count, 6
|
26
|
+
assert_equal hg.activity.commit_count(after: 'b14fa4692f949940bd1e28da6fb4617de2615484'), 4
|
27
|
+
assert_equal hg.activity.commit_count(after: '655f04cf6ad708ab58c7b941672dce09dd369a18'), 1
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'commit_count_with_empty_branch' do
|
32
32
|
with_hg_repository('hg', '') do |hg|
|
33
|
-
hg.scm.branch_name
|
34
|
-
hg.activity.commit_count
|
35
|
-
hg.activity.commit_count(after: 'b14fa4692f949940bd1e28da6fb4617de2615484')
|
36
|
-
hg.activity.commit_count(after: '655f04cf6ad708ab58c7b941672dce09dd369a18')
|
33
|
+
assert_nil hg.scm.branch_name
|
34
|
+
assert_equal hg.activity.commit_count, 6
|
35
|
+
assert_equal hg.activity.commit_count(after: 'b14fa4692f949940bd1e28da6fb4617de2615484'), 4
|
36
|
+
assert_equal hg.activity.commit_count(after: '655f04cf6ad708ab58c7b941672dce09dd369a18'), 1
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'commits' do
|
41
41
|
with_hg_repository('hg') do |hg|
|
42
|
-
hg.activity.commits.map(&:token)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
assert_equal hg.activity.commits.map(&:token), %w[01101d8ef3cea7da9ac6e9a226d645f4418f05c9
|
43
|
+
b14fa4692f949940bd1e28da6fb4617de2615484
|
44
|
+
468336c6671cbc58237a259d1b7326866afc2817
|
45
|
+
75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
46
|
+
655f04cf6ad708ab58c7b941672dce09dd369a18
|
47
|
+
1f45520fff3982761cfe7a0502ad0888d5783efe]
|
48
48
|
|
49
49
|
after = '655f04cf6ad708ab58c7b941672dce09dd369a18'
|
50
|
-
hg.activity.commits(after: after).map(&:token)
|
50
|
+
assert_equal hg.activity.commits(after: after).map(&:token), ['1f45520fff3982761cfe7a0502ad0888d5783efe']
|
51
51
|
|
52
52
|
# Check that the diffs are not populated
|
53
|
-
hg.activity.commits(after: '655f04cf6ad708ab58c7b941672dce09dd369a18').first.diffs
|
53
|
+
assert_empty hg.activity.commits(after: '655f04cf6ad708ab58c7b941672dce09dd369a18').first.diffs
|
54
54
|
|
55
|
-
hg.activity.commits(after: '1f45520fff3982761cfe7a0502ad0888d5783efe')
|
55
|
+
assert_empty hg.activity.commits(after: '1f45520fff3982761cfe7a0502ad0888d5783efe')
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'commits_with_branch' do
|
60
60
|
with_hg_repository('hg', 'develop') do |hg|
|
61
|
-
hg.activity.commits.map(&:token)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
assert_equal hg.activity.commits.map(&:token), %w[01101d8ef3cea7da9ac6e9a226d645f4418f05c9
|
62
|
+
b14fa4692f949940bd1e28da6fb4617de2615484
|
63
|
+
468336c6671cbc58237a259d1b7326866afc2817
|
64
|
+
75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
65
|
+
4d54c3f0526a1ec89214a70615a6b1c6129c665c]
|
66
66
|
|
67
67
|
after = '75532c1e1f1de55c2271f6fd29d98efbe35397c4'
|
68
|
-
hg.activity.commits(after: after).map(&:token)
|
68
|
+
assert_equal hg.activity.commits(after: after).map(&:token), ['4d54c3f0526a1ec89214a70615a6b1c6129c665c']
|
69
69
|
|
70
70
|
# Check that the diffs are not populated
|
71
|
-
hg.activity.commits(after: '75532c1e1f1de55c2271f6fd29d98efbe35397c4').first.diffs
|
71
|
+
assert_empty hg.activity.commits(after: '75532c1e1f1de55c2271f6fd29d98efbe35397c4').first.diffs
|
72
72
|
|
73
|
-
hg.activity.commits(after: '4d54c3f0526a1ec89214a70615a6b1c6129c665c')
|
73
|
+
assert_empty hg.activity.commits(after: '4d54c3f0526a1ec89214a70615a6b1c6129c665c')
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'trunk_only_commit_count' do
|
78
78
|
with_hg_repository('hg_dupe_delete') do |hg|
|
79
|
-
hg.activity.commit_count(trunk_only: false)
|
80
|
-
hg.activity.commit_count(trunk_only: true)
|
79
|
+
assert_equal hg.activity.commit_count(trunk_only: false), 4
|
80
|
+
assert_equal hg.activity.commit_count(trunk_only: true), 3
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'trunk_only_commits' do
|
85
85
|
with_hg_repository('hg_dupe_delete') do |hg|
|
86
|
-
hg.activity.commits(trunk_only: true)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
assert_equal hg.activity.commits(trunk_only: true)
|
87
|
+
.map(&:token), ['73e93f57224e3fd828cf014644db8eec5013cd6b',
|
88
|
+
'732345b1d5f4076498132fd4b965b1fec0108a50',
|
89
|
+
# '525de321d8085bc1d4a3c7608fda6b4020027985', # branch
|
90
|
+
'72fe74d643bdcb30b00da3b58796c50f221017d0']
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -111,12 +111,12 @@ describe 'Hg::Activity' do
|
|
111
111
|
refute File.exist?(hg.activity.send(:log_filename)) # Make sure we cleaned up after ourselves
|
112
112
|
|
113
113
|
# Verify that we got the commits in forward chronological order
|
114
|
-
commits.map(&:token)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
114
|
+
assert_equal commits.map(&:token), %w[01101d8ef3cea7da9ac6e9a226d645f4418f05c9
|
115
|
+
b14fa4692f949940bd1e28da6fb4617de2615484
|
116
|
+
468336c6671cbc58237a259d1b7326866afc2817
|
117
|
+
75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
118
|
+
655f04cf6ad708ab58c7b941672dce09dd369a18
|
119
|
+
1f45520fff3982761cfe7a0502ad0888d5783efe]
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -127,11 +127,11 @@ describe 'Hg::Activity' do
|
|
127
127
|
commits = hg.activity.each_commit
|
128
128
|
end
|
129
129
|
|
130
|
-
commits.map(&:token)
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
130
|
+
assert_equal commits.map(&:token), %w[01101d8ef3cea7da9ac6e9a226d645f4418f05c9
|
131
|
+
b14fa4692f949940bd1e28da6fb4617de2615484
|
132
|
+
468336c6671cbc58237a259d1b7326866afc2817
|
133
|
+
75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
134
|
+
4d54c3f0526a1ec89214a70615a6b1c6129c665c]
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'each_commit_after' do
|
@@ -140,16 +140,16 @@ describe 'Hg::Activity' do
|
|
140
140
|
hg.activity.each_commit(after: '468336c6671cbc58237a259d1b7326866afc2817') do |c|
|
141
141
|
commits << c
|
142
142
|
end
|
143
|
-
commits.map(&:token)
|
144
|
-
|
145
|
-
|
143
|
+
assert_equal commits.map(&:token), %w[75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
144
|
+
655f04cf6ad708ab58c7b941672dce09dd369a18
|
145
|
+
1f45520fff3982761cfe7a0502ad0888d5783efe]
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'open_log_file_encoding' do
|
150
150
|
with_hg_repository('hg_with_invalid_encoding') do |hg|
|
151
151
|
hg.activity.send(:open_log_file) do |io|
|
152
|
-
io.read.valid_encoding
|
152
|
+
assert_equal io.read.valid_encoding?, true
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
@@ -170,15 +170,15 @@ describe 'Hg::Activity' do
|
|
170
170
|
describe 'head' do
|
171
171
|
it 'hg_head_and_parents' do
|
172
172
|
with_hg_repository('hg') do |hg|
|
173
|
-
hg.activity.head_token
|
174
|
-
hg.activity.head.token
|
173
|
+
assert_equal hg.activity.head_token, '1f45520fff3982761cfe7a0502ad0888d5783efe'
|
174
|
+
assert_equal hg.activity.head.token, '1f45520fff3982761cfe7a0502ad0888d5783efe'
|
175
175
|
assert hg.activity.head.diffs.any? # diffs should be populated
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
179
|
it 'head_with_branch' do
|
180
180
|
with_hg_repository('hg', 'develop') do |hg|
|
181
|
-
hg.activity.head.token
|
181
|
+
assert_equal hg.activity.head.token, '4d54c3f0526a1ec89214a70615a6b1c6129c665c'
|
182
182
|
assert hg.activity.head.diffs.any?
|
183
183
|
end
|
184
184
|
end
|
@@ -187,54 +187,54 @@ describe 'Hg::Activity' do
|
|
187
187
|
describe 'commit_tokens' do
|
188
188
|
it 'must work with after argument' do
|
189
189
|
with_hg_repository('hg') do |hg|
|
190
|
-
hg.activity.commit_tokens
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
190
|
+
assert_equal hg.activity.commit_tokens, %w[01101d8ef3cea7da9ac6e9a226d645f4418f05c9
|
191
|
+
b14fa4692f949940bd1e28da6fb4617de2615484
|
192
|
+
468336c6671cbc58237a259d1b7326866afc2817
|
193
|
+
75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
194
|
+
655f04cf6ad708ab58c7b941672dce09dd369a18
|
195
|
+
1f45520fff3982761cfe7a0502ad0888d5783efe]
|
196
196
|
|
197
197
|
after = '01101d8ef3cea7da9ac6e9a226d645f4418f05c9'
|
198
|
-
hg.activity.commit_tokens(after: after)
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
198
|
+
assert_equal hg.activity.commit_tokens(after: after), %w[b14fa4692f949940bd1e28da6fb4617de2615484
|
199
|
+
468336c6671cbc58237a259d1b7326866afc2817
|
200
|
+
75532c1e1f1de55c2271f6fd29d98efbe35397c4
|
201
|
+
655f04cf6ad708ab58c7b941672dce09dd369a18
|
202
|
+
1f45520fff3982761cfe7a0502ad0888d5783efe]
|
203
203
|
|
204
204
|
after = '655f04cf6ad708ab58c7b941672dce09dd369a18'
|
205
|
-
hg.activity.commit_tokens(after: after)
|
205
|
+
assert_equal hg.activity.commit_tokens(after: after), ['1f45520fff3982761cfe7a0502ad0888d5783efe']
|
206
206
|
|
207
|
-
hg.activity.commit_tokens(after: '1f45520fff3982761cfe7a0502ad0888d5783efe')
|
207
|
+
assert_empty hg.activity.commit_tokens(after: '1f45520fff3982761cfe7a0502ad0888d5783efe')
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
211
|
it 'must work with trunk_only argument' do
|
212
212
|
with_hg_repository('hg_dupe_delete') do |hg|
|
213
|
-
hg.activity.commit_tokens(trunk_only: false)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
hg.activity.commit_tokens(trunk_only: true)
|
219
|
-
|
220
|
-
|
221
|
-
|
213
|
+
assert_equal hg.activity.commit_tokens(trunk_only: false), %w[73e93f57224e3fd828cf014644db8eec5013cd6b
|
214
|
+
732345b1d5f4076498132fd4b965b1fec0108a50
|
215
|
+
525de321d8085bc1d4a3c7608fda6b4020027985
|
216
|
+
72fe74d643bdcb30b00da3b58796c50f221017d0]
|
217
|
+
|
218
|
+
assert_equal hg.activity.commit_tokens(trunk_only: true),
|
219
|
+
['73e93f57224e3fd828cf014644db8eec5013cd6b', '732345b1d5f4076498132fd4b965b1fec0108a50',
|
220
|
+
# '525de321d8085bc1d4a3c7608fda6b4020027985', # branch
|
221
|
+
'72fe74d643bdcb30b00da3b58796c50f221017d0']
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
225
|
it 'must work with trunk_only and after arguments' do
|
226
226
|
with_hg_repository('hg_dupe_delete') do |hg|
|
227
227
|
opts = { after: '73e93f57224e3fd828cf014644db8eec5013cd6b', trunk_only: false }
|
228
|
-
hg.activity.commit_tokens(opts)
|
229
|
-
|
230
|
-
|
228
|
+
assert_equal hg.activity.commit_tokens(opts), %w[732345b1d5f4076498132fd4b965b1fec0108a50
|
229
|
+
525de321d8085bc1d4a3c7608fda6b4020027985
|
230
|
+
72fe74d643bdcb30b00da3b58796c50f221017d0]
|
231
231
|
|
232
232
|
opts = { after: '73e93f57224e3fd828cf014644db8eec5013cd6b', trunk_only: true }
|
233
|
-
hg.activity.commit_tokens(opts)
|
234
|
-
|
235
|
-
|
233
|
+
assert_equal hg.activity.commit_tokens(opts), ['732345b1d5f4076498132fd4b965b1fec0108a50',
|
234
|
+
# '525de321d8085bc1d4a3c7608fda6b4020027985', # On branch
|
235
|
+
'72fe74d643bdcb30b00da3b58796c50f221017d0']
|
236
236
|
|
237
|
-
hg.activity.commit_tokens(after: '72fe74d643bdcb30b00da3b58796c50f221017d0', trunk_only: true)
|
237
|
+
assert_empty hg.activity.commit_tokens(after: '72fe74d643bdcb30b00da3b58796c50f221017d0', trunk_only: true)
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
@@ -242,21 +242,21 @@ describe 'Hg::Activity' do
|
|
242
242
|
with_hg_repository('hg_walk') do |hg|
|
243
243
|
commit_tokens = CommitTokensHelper.new(hg, commit_labels)
|
244
244
|
# Full history to a commit
|
245
|
-
commit_tokens.between(nil, :A)
|
246
|
-
commit_tokens.between(nil, :B)
|
247
|
-
commit_tokens.between(nil, :C)
|
248
|
-
commit_tokens.between(nil, :D)
|
249
|
-
commit_tokens.between(nil, :G)
|
250
|
-
commit_tokens.between(nil, :H)
|
251
|
-
commit_tokens.between(nil, :I)
|
245
|
+
assert_equal commit_tokens.between(nil, :A), %i[A]
|
246
|
+
assert_equal commit_tokens.between(nil, :B), %i[A B]
|
247
|
+
assert_equal commit_tokens.between(nil, :C), %i[A B G H C]
|
248
|
+
assert_equal commit_tokens.between(nil, :D), %i[A B G H C I D]
|
249
|
+
assert_equal commit_tokens.between(nil, :G), %i[A B G]
|
250
|
+
assert_equal commit_tokens.between(nil, :H), %i[A B G H]
|
251
|
+
assert_equal commit_tokens.between(nil, :I), %i[A B G H C I]
|
252
252
|
|
253
253
|
# Limited history from one commit to another
|
254
|
-
commit_tokens.between(:A, :A)
|
255
|
-
commit_tokens.between(:A, :B)
|
256
|
-
commit_tokens.between(:A, :C)
|
257
|
-
commit_tokens.between(:A, :D)
|
258
|
-
commit_tokens.between(:B, :D)
|
259
|
-
commit_tokens.between(:C, :D)
|
254
|
+
assert_empty commit_tokens.between(:A, :A)
|
255
|
+
assert_equal commit_tokens.between(:A, :B), %i[B]
|
256
|
+
assert_equal commit_tokens.between(:A, :C), %i[B G H C]
|
257
|
+
assert_equal commit_tokens.between(:A, :D), %i[B G H C I D]
|
258
|
+
assert_equal commit_tokens.between(:B, :D), %i[G H C I D]
|
259
|
+
assert_equal commit_tokens.between(:C, :D), %i[I D]
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
@@ -292,9 +292,9 @@ describe 'Hg::Activity' do
|
|
292
292
|
diff = OhlohScm::Diff.new(path: 'helloworld.c')
|
293
293
|
commit = OhlohScm::Commit.new(token: '75532c1e1f1d')
|
294
294
|
# The file was deleted in revision 468336c6671c. Check that it does not exist now, but existed in parent.
|
295
|
-
hg.activity.cat_file(commit, diff)
|
296
|
-
hg.activity.cat_file_parent(commit, diff)
|
297
|
-
hg.activity.cat_file(OhlohScm::Commit.new(token: '468336c6671c'), diff)
|
295
|
+
assert_nil hg.activity.cat_file(commit, diff)
|
296
|
+
assert_equal hg.activity.cat_file_parent(commit, diff), expected
|
297
|
+
assert_equal hg.activity.cat_file(OhlohScm::Commit.new(token: '468336c6671c'), diff), expected
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
@@ -304,7 +304,7 @@ describe 'Hg::Activity' do
|
|
304
304
|
# Make a file with a problematic filename
|
305
305
|
funny_name = '#|file_name` $(&\'")#'
|
306
306
|
file_content = 'foobar'
|
307
|
-
File.
|
307
|
+
File.write(File.join(dir, funny_name), file_content)
|
308
308
|
|
309
309
|
# Add it to an hg repository
|
310
310
|
`cd #{dir} && hg init && hg add * 2> /dev/null && hg commit -u tester -m test`
|
@@ -312,7 +312,7 @@ describe 'Hg::Activity' do
|
|
312
312
|
# Confirm that we can read the file back
|
313
313
|
hg = OhlohScm::Factory.get_core(scm_type: :hg, url: dir)
|
314
314
|
diff = OhlohScm::Diff.new(path: funny_name)
|
315
|
-
hg.activity.cat_file(hg.activity.head, diff)
|
315
|
+
assert_equal hg.activity.cat_file(hg.activity.head, diff), file_content
|
316
316
|
end
|
317
317
|
end
|
318
318
|
end
|
@@ -5,18 +5,18 @@ describe 'Hg::Scm' do
|
|
5
5
|
with_hg_repository('hg') do |src|
|
6
6
|
tmpdir do |dir|
|
7
7
|
dest = OhlohScm::Factory.get_core(scm_type: :hg, url: dir)
|
8
|
-
dest.status.
|
8
|
+
assert !dest.status.exist?
|
9
9
|
|
10
10
|
dest.scm.pull(src.scm, TestCallback.new)
|
11
|
-
dest.status.
|
12
|
-
Dir.entries(dir).sort
|
11
|
+
assert dest.status.exist?
|
12
|
+
assert_equal Dir.entries(dir).sort, ['.', '..', '.hg']
|
13
13
|
|
14
14
|
# Commit some new code on the original and pull again
|
15
15
|
run_p "cd '#{src.scm.url}' && touch foo && hg add foo && hg commit -u test -m test"
|
16
|
-
src.activity.commits.last.message
|
16
|
+
assert_equal src.activity.commits.last.message, "test\n"
|
17
17
|
|
18
18
|
dest.scm.pull(src.scm, TestCallback.new)
|
19
|
-
Dir.entries(dir).sort
|
19
|
+
assert_equal Dir.entries(dir).sort, ['.', '..', '.hg']
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -17,13 +17,13 @@ describe 'ArrayWriter' do
|
|
17
17
|
LOG
|
18
18
|
|
19
19
|
commits = OhlohScm::GitParser.parse(log)
|
20
|
-
commits.size
|
20
|
+
assert_equal commits.size, 1
|
21
21
|
commit = commits.first
|
22
|
-
commit.token
|
23
|
-
commit.author_name
|
24
|
-
commit.author_email
|
25
|
-
commit.message
|
26
|
-
commit.author_date
|
27
|
-
commit.diffs.size
|
22
|
+
assert_equal commit.token, '1df547800dcd168e589bb9b26b4039bff3a7f7e4'
|
23
|
+
assert_equal commit.author_name, 'Jason Allen'
|
24
|
+
assert_equal commit.author_email, 'jason@ohloh.net'
|
25
|
+
assert_equal commit.message, "moving COPYING\n"
|
26
|
+
assert_equal commit.author_date, Time.utc(2006, 7, 14, 23, 7, 15)
|
27
|
+
assert_equal commit.diffs.size, 1
|
28
28
|
end
|
29
29
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'BranchNumber' do
|
4
4
|
it 'must test basic' do
|
5
|
-
OhlohScm::BranchNumber.new('1.1').to_a
|
6
|
-
OhlohScm::BranchNumber.new('1234.1234').to_a
|
7
|
-
OhlohScm::BranchNumber.new('1.2.3.4').to_a
|
5
|
+
assert_equal OhlohScm::BranchNumber.new('1.1').to_a, [1, 1]
|
6
|
+
assert_equal OhlohScm::BranchNumber.new('1234.1234').to_a, [1234, 1234]
|
7
|
+
assert_equal OhlohScm::BranchNumber.new('1.2.3.4').to_a, [1, 2, 3, 4]
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'must test simple inherits_from' do
|
@@ -3,48 +3,48 @@ require 'spec_helper'
|
|
3
3
|
describe 'CvsParser' do
|
4
4
|
describe 'parse' do
|
5
5
|
it 'must return empty array' do
|
6
|
-
OhlohScm::CvsParser.parse('')
|
6
|
+
assert_empty OhlohScm::CvsParser.parse('')
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'must parse the log' do
|
10
|
-
revisions = OhlohScm::CvsParser.parse File.read(FIXTURES_DIR
|
10
|
+
revisions = OhlohScm::CvsParser.parse File.read("#{FIXTURES_DIR}/basic.rlog")
|
11
11
|
|
12
|
-
revisions.size
|
12
|
+
assert_equal revisions.size, 2
|
13
13
|
|
14
|
-
revisions[0].token
|
15
|
-
revisions[0].committer_name
|
16
|
-
Time.utc(2005, 0o7, 25, 17, 9, 59)
|
17
|
-
revisions[0].message
|
14
|
+
assert_equal revisions[0].token, '2005/07/25 17:09:59'
|
15
|
+
assert_equal revisions[0].committer_name, 'pizzandre'
|
16
|
+
assert_equal Time.utc(2005, 0o7, 25, 17, 9, 59), revisions[0].committer_date
|
17
|
+
assert_equal revisions[0].message, '*** empty log message ***'
|
18
18
|
|
19
|
-
revisions[1].token
|
20
|
-
revisions[1].committer_name
|
21
|
-
Time.utc(2005, 0o7, 25, 17, 11, 6)
|
22
|
-
revisions[1].message
|
19
|
+
assert_equal revisions[1].token, '2005/07/25 17:11:06'
|
20
|
+
assert_equal revisions[1].committer_name, 'pizzandre'
|
21
|
+
assert_equal Time.utc(2005, 0o7, 25, 17, 11, 6), revisions[1].committer_date
|
22
|
+
assert_equal revisions[1].message, 'Addin UNL file with using example-'
|
23
23
|
end
|
24
24
|
|
25
25
|
# One file with several revisions
|
26
26
|
it 'must test multiple revisions' do
|
27
|
-
revisions = OhlohScm::CvsParser.parse File.read(FIXTURES_DIR
|
27
|
+
revisions = OhlohScm::CvsParser.parse File.read("#{FIXTURES_DIR}/multiple_revisions.rlog")
|
28
28
|
|
29
29
|
# There are 9 revisions in the rlog, but some of them are close together with the same message.
|
30
30
|
# Therefore we bin them together into only 7 revisions.
|
31
|
-
revisions.size
|
31
|
+
assert_equal revisions.size, 7
|
32
32
|
|
33
|
-
revisions[0].token
|
34
|
-
revisions[0].committer_name
|
35
|
-
revisions[0].message
|
33
|
+
assert_equal revisions[0].token, '2005/07/15 11:53:30'
|
34
|
+
assert_equal revisions[0].committer_name, 'httpd'
|
35
|
+
assert_equal revisions[0].message, 'Initial data for the intelliglue project'
|
36
36
|
|
37
|
-
revisions[1].token
|
38
|
-
revisions[1].committer_name
|
39
|
-
revisions[1].message
|
37
|
+
assert_equal revisions[1].token, '2005/07/15 16:40:17'
|
38
|
+
assert_equal revisions[1].committer_name, 'pizzandre'
|
39
|
+
assert_equal revisions[1].message, '*** empty log message ***'
|
40
40
|
|
41
|
-
revisions[5].token
|
42
|
-
revisions[5].committer_name
|
41
|
+
assert_equal revisions[5].token, '2005/07/26 20:35:13'
|
42
|
+
assert_equal revisions[5].committer_name, 'pizzandre'
|
43
43
|
assert_equal "Issue number:\nObtained from:\nSubmitted by:\nReviewed by:\nAdding current milestones-",
|
44
44
|
revisions[5].message
|
45
45
|
|
46
|
-
revisions[6].token
|
47
|
-
revisions[6].committer_name
|
46
|
+
assert_equal revisions[6].token, '2005/07/26 20:39:16'
|
47
|
+
assert_equal revisions[6].committer_name, 'pizzandre'
|
48
48
|
assert_equal "Issue number:\nObtained from:\nSubmitted by:\nReviewed by:\nCompleting and fixing milestones texts",
|
49
49
|
revisions[6].message
|
50
50
|
end
|
@@ -52,26 +52,26 @@ describe 'CvsParser' do
|
|
52
52
|
# A file is created and modified on the branch, then merged to the trunk, then deleted from the branch.
|
53
53
|
# From the trunk's point of view, we should see only the merge event.
|
54
54
|
it 'must test file created on branch as seen from trunk' do
|
55
|
-
revisions = OhlohScm::CvsParser.parse File.read(FIXTURES_DIR
|
56
|
-
revisions.size
|
57
|
-
revisions[0].message
|
55
|
+
revisions = OhlohScm::CvsParser.parse File.read("#{FIXTURES_DIR}/file_created_on_branch.rlog")
|
56
|
+
assert_equal revisions.size, 1
|
57
|
+
assert_equal revisions[0].message, 'merged new_file.rb from branch onto the HEAD'
|
58
58
|
end
|
59
59
|
|
60
60
|
# A file is created on the vender branch. This causes a simultaneous checkin on HEAD
|
61
61
|
# with a different message ('Initial revision') but same committer_name name and timestamp.
|
62
62
|
# We should only pick up one of these checkins.
|
63
63
|
it 'must test simultaneous checkins' do
|
64
|
-
revisions = OhlohScm::CvsParser.parse File.read(FIXTURES_DIR
|
65
|
-
revisions.size
|
66
|
-
revisions[0].message
|
64
|
+
revisions = OhlohScm::CvsParser.parse File.read("#{FIXTURES_DIR}/simultaneous_checkins.rlog")
|
65
|
+
assert_equal revisions.size, 1
|
66
|
+
assert_equal revisions[0].message, 'Initial revision'
|
67
67
|
end
|
68
68
|
|
69
69
|
# Two different authors check in with two different messages at the exact same moment.
|
70
70
|
# How this happens is a mystery, but I have seen it in rlogs.
|
71
71
|
# We arbitrarily choose the first one if so.
|
72
72
|
it 'must test simultaneous checkins_2' do
|
73
|
-
revisions = OhlohScm::CvsParser.parse File.read(FIXTURES_DIR
|
74
|
-
revisions.size
|
73
|
+
revisions = OhlohScm::CvsParser.parse File.read("#{FIXTURES_DIR}/simultaneous_checkins_2.rlog")
|
74
|
+
assert_equal revisions.size, 1
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -3,27 +3,24 @@ require 'spec_helper'
|
|
3
3
|
describe 'GitParser' do
|
4
4
|
describe 'parse' do
|
5
5
|
it 'must be empty for blank string' do
|
6
|
-
OhlohScm::GitParser.parse('')
|
6
|
+
assert_empty OhlohScm::GitParser.parse('')
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'must return epoch time for log with no date' do
|
10
|
-
# rubocop:disable Layout/TrailingWhitespace
|
11
10
|
sample_log = <<-SAMPLE.gsub(/^ {8}/, '')
|
12
11
|
__BEGIN_COMMIT__
|
13
12
|
Commit: 1df547800dcd168e589bb9b26b4039bff3a7f7e4
|
14
13
|
Author: Jason Allen
|
15
14
|
AuthorEmail: jason@ohloh.net
|
16
|
-
Date
|
15
|
+
Date:#{' '}
|
17
16
|
__BEGIN_COMMENT__
|
18
17
|
moving COPYING
|
19
18
|
|
20
19
|
__END_COMMENT__
|
21
20
|
SAMPLE
|
22
|
-
# rubocop:enable Layout/TrailingWhitespace
|
23
|
-
|
24
21
|
commits = OhlohScm::GitParser.parse(sample_log)
|
25
|
-
commits.size
|
26
|
-
commits[0].author_date
|
22
|
+
assert_equal commits.size, 1
|
23
|
+
assert_equal commits[0].author_date, Time.utc(1970, 1, 1, 0, 0, 0)
|
27
24
|
end
|
28
25
|
|
29
26
|
it 'must return epoch time for log with invalid date' do
|
@@ -40,8 +37,8 @@ describe 'GitParser' do
|
|
40
37
|
SAMPLE
|
41
38
|
|
42
39
|
commits = OhlohScm::GitParser.parse(sample_log)
|
43
|
-
commits.size
|
44
|
-
commits[0].author_date
|
40
|
+
assert_equal commits.size, 1
|
41
|
+
assert_equal commits[0].author_date, Time.utc(1970, 1, 1, 0, 0, 0)
|
45
42
|
end
|
46
43
|
|
47
44
|
it 'must parse a log correctly' do
|
@@ -74,29 +71,29 @@ describe 'GitParser' do
|
|
74
71
|
|
75
72
|
commits = OhlohScm::GitParser.parse(sample_log)
|
76
73
|
|
77
|
-
commits.size
|
78
|
-
|
79
|
-
commits[0].token
|
80
|
-
commits[0].author_name
|
81
|
-
commits[0].author_email
|
82
|
-
commits[0].message
|
83
|
-
commits[0].author_date
|
84
|
-
commits[0].diffs.size
|
85
|
-
|
86
|
-
commits[0].diffs[0].action
|
87
|
-
commits[0].diffs[0].path
|
88
|
-
|
89
|
-
commits[1].token
|
90
|
-
commits[1].author_name
|
91
|
-
commits[1].author_email
|
92
|
-
commits[1].message
|
93
|
-
commits[1].author_date
|
94
|
-
commits[1].diffs.size
|
95
|
-
|
96
|
-
commits[1].diffs[0].action
|
97
|
-
commits[1].diffs[0].path
|
98
|
-
commits[1].diffs[1].action
|
99
|
-
commits[1].diffs[1].path
|
74
|
+
assert_equal commits.size, 2
|
75
|
+
|
76
|
+
assert_equal commits[0].token, '1df547800dcd168e589bb9b26b4039bff3a7f7e4'
|
77
|
+
assert_equal commits[0].author_name, 'Jason Allen'
|
78
|
+
assert_equal commits[0].author_email, 'jason@ohloh.net'
|
79
|
+
assert_equal commits[0].message, "moving COPYING\n"
|
80
|
+
assert_equal commits[0].author_date, Time.utc(2006, 7, 14, 23, 7, 15)
|
81
|
+
assert_equal commits[0].diffs.size, 1
|
82
|
+
|
83
|
+
assert_equal commits[0].diffs[0].action, 'A'
|
84
|
+
assert_equal commits[0].diffs[0].path, 'COPYING'
|
85
|
+
|
86
|
+
assert_equal commits[1].token, '2e9366dd7a786fdb35f211fff1c8ea05c51968b1'
|
87
|
+
assert_equal commits[1].author_name, 'Robin Luckey'
|
88
|
+
assert_equal commits[1].author_email, 'robin@ohloh.net'
|
89
|
+
assert_equal commits[1].message, "added some documentation and licensing info\n"
|
90
|
+
assert_equal commits[1].author_date, Time.utc(2006, 6, 11, 18, 34, 17)
|
91
|
+
assert_equal commits[1].diffs.size, 2
|
92
|
+
|
93
|
+
assert_equal commits[1].diffs[0].action, 'M'
|
94
|
+
assert_equal commits[1].diffs[0].path, 'README'
|
95
|
+
assert_equal commits[1].diffs[1].action, 'D'
|
96
|
+
assert_equal commits[1].diffs[1].path, 'helloworld.c'
|
100
97
|
end
|
101
98
|
end
|
102
99
|
end
|