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
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe 'HgParser' do
|
4
4
|
describe 'parser' do
|
5
5
|
it 'must return an empty list for blank log' do
|
6
|
-
OhlohScm::HgParser.parse('')
|
6
|
+
assert_empty OhlohScm::HgParser.parse('')
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'must parse log into commits' do
|
@@ -30,21 +30,21 @@ describe 'HgParser' do
|
|
30
30
|
commits = OhlohScm::HgParser.parse(sample_log)
|
31
31
|
|
32
32
|
assert commits
|
33
|
-
commits.size
|
34
|
-
|
35
|
-
commits[0].token.
|
36
|
-
commits[0].committer_name
|
37
|
-
commits[0].committer_email
|
38
|
-
commits[0].message
|
39
|
-
commits[0].committer_date.to_i
|
40
|
-
commits[0].diffs.size
|
41
|
-
|
42
|
-
commits[1].token.
|
43
|
-
commits[1].committer_name
|
44
|
-
commits[1].committer_email
|
45
|
-
commits[1].message
|
46
|
-
commits[1].committer_date.to_i
|
47
|
-
commits[1].diffs.size
|
33
|
+
assert_equal commits.size, 2
|
34
|
+
|
35
|
+
assert commits[0].token.match?('655f04cf6ad708')
|
36
|
+
assert_equal commits[0].committer_name, 'Alex'
|
37
|
+
assert_equal commits[0].committer_email, 'alex@example.com'
|
38
|
+
assert_equal commits[0].message, "added makefile\n" # Note \n at end of comment
|
39
|
+
assert_equal commits[0].committer_date.to_i, Time.utc(2009, 1, 20, 19, 33, 17).to_i
|
40
|
+
assert_equal commits[0].diffs.size, 0
|
41
|
+
|
42
|
+
assert commits[1].token.match?('01101d8ef3ce')
|
43
|
+
assert_equal commits[1].committer_name, 'Robin Luckey'
|
44
|
+
assert_equal commits[1].committer_email, 'robin@ohloh.net'
|
45
|
+
assert_equal commits[1].message, "Initial Checkin\n" # Note \n at end of comment
|
46
|
+
assert_equal commits[1].committer_date.to_i, Time.utc(2009, 1, 20, 19, 32, 54).to_i
|
47
|
+
assert_equal commits[1].diffs.size, 0
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'must set committer_name to email and committer_email to NULL when name is not present' do
|
@@ -62,11 +62,11 @@ describe 'HgParser' do
|
|
62
62
|
commits = OhlohScm::HgParser.parse(sample_log)
|
63
63
|
|
64
64
|
assert commits
|
65
|
-
commits.size
|
65
|
+
assert_equal commits.size, 1
|
66
66
|
|
67
|
-
commits[0].token.
|
68
|
-
commits[0].committer_name
|
69
|
-
commits[0].committer_email
|
67
|
+
assert commits[0].token.match?('01101d8ef3ce')
|
68
|
+
assert_equal commits[0].committer_name, 'robin@ohloh.net'
|
69
|
+
assert_nil commits[0].committer_email
|
70
70
|
end
|
71
71
|
|
72
72
|
# Sometimes the log does not include a summary
|
@@ -86,14 +86,14 @@ describe 'HgParser' do
|
|
86
86
|
commits = OhlohScm::HgParser.parse(sample_log)
|
87
87
|
|
88
88
|
assert commits
|
89
|
-
commits.size
|
90
|
-
|
91
|
-
commits[0].token.
|
92
|
-
commits[0].committer_name
|
93
|
-
commits[0].committer_email
|
94
|
-
commits[0].message
|
95
|
-
commits[0].committer_date.to_i
|
96
|
-
commits[0].diffs.size
|
89
|
+
assert_equal commits.size, 2
|
90
|
+
|
91
|
+
assert commits[0].token.match?('655f04cf6ad708')
|
92
|
+
assert_equal commits[0].committer_name, 'Alex'
|
93
|
+
assert_equal commits[0].committer_email, 'alex@example.com'
|
94
|
+
assert_nil commits[0].message
|
95
|
+
assert_equal commits[0].committer_date.to_i, Time.utc(2009, 1, 20, 19, 33, 17).to_i
|
96
|
+
assert_equal commits[0].diffs.size, 0
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'must parse verbose log into commits and diffs' do
|
@@ -126,22 +126,22 @@ describe 'HgParser' do
|
|
126
126
|
commits = OhlohScm::HgParser.parse(sample_log)
|
127
127
|
|
128
128
|
assert commits
|
129
|
-
commits.size
|
130
|
-
|
131
|
-
commits[0].token.
|
132
|
-
commits[0].committer_name
|
133
|
-
commits[0].committer_email
|
134
|
-
commits[0].message
|
135
|
-
commits[0].committer_date.to_i
|
136
|
-
commits[0].diffs[0].path
|
137
|
-
|
138
|
-
commits[1].token.
|
139
|
-
commits[1].committer_name
|
140
|
-
commits[1].committer_email
|
141
|
-
commits[1].message
|
142
|
-
commits[1].committer_date.to_i
|
143
|
-
commits[1].diffs.size
|
144
|
-
commits[1].diffs[0].path
|
129
|
+
assert_equal commits.size, 2
|
130
|
+
|
131
|
+
assert commits[0].token.match?('655f04cf6ad708')
|
132
|
+
assert_equal commits[0].committer_name, 'Alex'
|
133
|
+
assert_equal commits[0].committer_email, 'alex@example.com'
|
134
|
+
assert_equal commits[0].message, "Adding file foobar\n" # Note \n at end of comment
|
135
|
+
assert_equal commits[0].committer_date.to_i, Time.utc(2009, 1, 20, 19, 33, 17).to_i
|
136
|
+
assert_equal commits[0].diffs[0].path, 'foobar'
|
137
|
+
|
138
|
+
assert commits[1].token.match?('01101d8ef3ce')
|
139
|
+
assert_equal commits[1].committer_name, 'Robin Luckey'
|
140
|
+
assert_equal commits[1].committer_email, 'robin@ohloh.net'
|
141
|
+
assert_equal commits[1].message, "Initial Checkin\n" # Note \n at end of comment
|
142
|
+
assert_equal commits[1].committer_date.to_i, Time.utc(2009, 1, 20, 19, 32, 54).to_i
|
143
|
+
assert_equal commits[1].diffs.size, 1
|
144
|
+
assert_equal commits[1].diffs[0].path, 'helloworld.c'
|
145
145
|
end
|
146
146
|
|
147
147
|
it 'must parse log with the --style argument' do
|
@@ -161,33 +161,33 @@ describe 'HgParser' do
|
|
161
161
|
protected
|
162
162
|
|
163
163
|
def assert_styled_commits(commits, with_diffs = false)
|
164
|
-
commits.size
|
164
|
+
assert_equal commits.size, 6
|
165
165
|
|
166
|
-
commits[1].token
|
167
|
-
commits[1].committer_name
|
168
|
-
commits[1].committer_email
|
166
|
+
assert_equal commits[1].token, '655f04cf6ad708ab58c7b941672dce09dd369a18'
|
167
|
+
assert_equal commits[1].committer_name, 'Alex'
|
168
|
+
assert_equal commits[1].committer_email, 'alex@example.com'
|
169
169
|
assert Time.utc(2009, 1, 20, 19, 34, 53) - commits[1].committer_date < 1 # Don't care about milliseconds
|
170
|
-
commits[1].message
|
170
|
+
assert_equal commits[1].message, "Adding file two\n"
|
171
171
|
|
172
172
|
if with_diffs
|
173
|
-
commits[1].diffs.size
|
174
|
-
commits[1].diffs[0].action
|
175
|
-
commits[1].diffs[0].path
|
173
|
+
assert_equal commits[1].diffs.size, 1
|
174
|
+
assert_equal commits[1].diffs[0].action, 'A'
|
175
|
+
assert_equal commits[1].diffs[0].path, 'two'
|
176
176
|
else
|
177
|
-
commits[1].diffs
|
177
|
+
assert_equal commits[1].diffs, []
|
178
178
|
end
|
179
179
|
|
180
|
-
commits[2].token
|
180
|
+
assert_equal commits[2].token, '75532c1e1f1de55c2271f6fd29d98efbe35397c4'
|
181
181
|
assert Time.utc(2009, 1, 20, 19, 34, 4) - commits[2].committer_date < 1
|
182
182
|
|
183
183
|
if with_diffs
|
184
|
-
commits[3].diffs.size
|
185
|
-
commits[3].diffs[0].action
|
186
|
-
commits[3].diffs[0].path
|
187
|
-
commits[3].diffs[1].action
|
188
|
-
commits[3].diffs[1].path
|
184
|
+
assert_equal commits[3].diffs.size, 2
|
185
|
+
assert_equal commits[3].diffs[0].action, 'M'
|
186
|
+
assert_equal commits[3].diffs[0].path, 'helloworld.c'
|
187
|
+
assert_equal commits[3].diffs[1].action, 'A'
|
188
|
+
assert_equal commits[3].diffs[1].path, 'README'
|
189
189
|
else
|
190
|
-
commits[0].diffs
|
190
|
+
assert_equal commits[0].diffs, []
|
191
191
|
end
|
192
192
|
end
|
193
193
|
end
|
@@ -3,14 +3,14 @@ require 'mocha'
|
|
3
3
|
|
4
4
|
describe 'Svn::Activity' do
|
5
5
|
describe 'cat' do
|
6
|
-
let(:
|
6
|
+
let(:commit1) { OhlohScm::Commit.new(token: 1) }
|
7
7
|
let(:hello_diff) { OhlohScm::Diff.new(path: 'helloworld.c') }
|
8
8
|
|
9
9
|
it 'must export data correctly' do
|
10
10
|
with_svn_repository('svn') do |svn|
|
11
11
|
tmpdir do |dir|
|
12
12
|
svn.activity.export(dir)
|
13
|
-
Dir.entries(dir).sort
|
13
|
+
assert_equal Dir.entries(dir).sort, %w[. .. branches tags trunk]
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -21,14 +21,14 @@ describe 'Svn::Activity' do
|
|
21
21
|
tmpdir('oh_scm_out_dir_') do |dir|
|
22
22
|
root_path = svn.activity.root
|
23
23
|
folder_name = root_path.slice(/[^\/]+\/?\Z/)
|
24
|
-
cmd = "cd #{svn_working_folder} && svn co #{root_path} && cd #{folder_name}"\
|
25
|
-
"
|
26
|
-
"
|
24
|
+
cmd = "cd #{svn_working_folder} && svn co #{root_path} && cd #{folder_name} " \
|
25
|
+
"&& mkdir -p #{root_path.gsub(/^file:../, '')}/db/transactions " \
|
26
|
+
"&& svn copy trunk tags/2.0 && svn commit -m 'v2.0' && svn update"
|
27
27
|
svn.activity.send :run, cmd
|
28
28
|
|
29
29
|
svn.activity.export_tag(dir, '2.0')
|
30
30
|
|
31
|
-
Dir.entries(dir).sort
|
31
|
+
assert_equal Dir.entries(dir).sort, %w[. .. COPYING README helloworld.c makefile]
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -39,15 +39,14 @@ describe 'Svn::Activity' do
|
|
39
39
|
tmpdir do |svn_working_folder|
|
40
40
|
root_path = svn.activity.root
|
41
41
|
folder_name = root_path.slice(/[^\/]+\/?\Z/)
|
42
|
-
cmd = "cd #{svn_working_folder} && svn co #{root_path} && cd #{folder_name}"\
|
43
|
-
"
|
44
|
-
"
|
42
|
+
cmd = "cd #{svn_working_folder} && svn co #{root_path} && cd #{folder_name} " \
|
43
|
+
"&& mkdir -p #{root_path.gsub(/^file:../, '')}/db/transactions " \
|
44
|
+
"&& svn copy trunk tags/2.0 && svn commit -m 'v2.0' && svn update"
|
45
45
|
svn.activity.send :run, cmd
|
46
46
|
|
47
|
-
svn.activity.tags.first[0..1]
|
47
|
+
assert_equal svn.activity.tags.first[0..1], ['2.0', '6']
|
48
48
|
# Avoid millisecond comparision.
|
49
|
-
svn.activity.tags.first[-1].strftime('%F %R')
|
50
|
-
.must_equal Time.now.utc.strftime('%F %R')
|
49
|
+
assert_equal svn.activity.tags.first[-1].strftime('%F %R'), Time.now.utc.strftime('%F %R')
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
@@ -2,73 +2,73 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'Svn::Scm' do
|
4
4
|
it 'must prefix file: to local path' do
|
5
|
-
get_core(:svn, url: '').scm.send(:prefix_file_for_local_path, '')
|
6
|
-
get_core(:svn, url: '/home/test').scm.send(:prefix_file_for_local_path, '/home/test')
|
7
|
-
|
5
|
+
assert_nil get_core(:svn, url: '').scm.send(:prefix_file_for_local_path, '')
|
6
|
+
assert_equal get_core(:svn, url: '/home/test').scm.send(:prefix_file_for_local_path, '/home/test'),
|
7
|
+
'file:///home/test'
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'must require https for sourceforge' do
|
11
11
|
OhlohScm::Svn::Scm.any_instance.stubs(:recalc_branch_name)
|
12
12
|
|
13
13
|
url = '://svn.code.sf.net/p/gallery/code/trunk/gallery2'
|
14
|
-
get_core(:svn, url: "http#{url}").scm.normalize.url
|
15
|
-
get_core(:svn, url: "https#{url}").scm.normalize.url
|
14
|
+
assert_equal get_core(:svn, url: "http#{url}").scm.normalize.url, "https#{url}"
|
15
|
+
assert_equal get_core(:svn, url: "https#{url}").scm.normalize.url, "https#{url}"
|
16
16
|
|
17
17
|
url = 'https://github.com/blackducksw/ohloh_scm/trunk'
|
18
|
-
get_core(:svn, url: url).scm.normalize.url
|
18
|
+
assert_equal get_core(:svn, url: url).scm.normalize.url, url
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'must recalc branch name' do
|
22
22
|
with_svn_repository('svn') do |svn_core|
|
23
23
|
svn_scm = get_core(:svn, url: svn_core.scm.url, branch_name: '').scm
|
24
|
-
svn_scm.branch_name
|
25
|
-
svn_scm.send(:recalc_branch_name)
|
26
|
-
svn_scm.branch_name
|
24
|
+
assert_nil svn_scm.branch_name
|
25
|
+
assert_empty svn_scm.send(:recalc_branch_name)
|
26
|
+
assert_empty svn_scm.branch_name
|
27
27
|
|
28
28
|
svn_scm = get_core(:svn, url: svn_core.scm.url, branch_name: '/').scm
|
29
|
-
svn_scm.send(:recalc_branch_name)
|
30
|
-
svn_scm.branch_name
|
29
|
+
assert_empty svn_scm.send(:recalc_branch_name)
|
30
|
+
assert_empty svn_scm.branch_name
|
31
31
|
|
32
|
-
svn_scm = get_core(:svn, url: svn_core.scm.url
|
32
|
+
svn_scm = get_core(:svn, url: "#{svn_core.scm.url}/trunk").scm
|
33
33
|
OhlohScm::Svn::Activity.any_instance.stubs(:root).returns(svn_core.scm.url)
|
34
34
|
svn_scm.send(:recalc_branch_name)
|
35
|
-
svn_scm.branch_name
|
35
|
+
assert_equal svn_scm.branch_name, '/trunk'
|
36
36
|
|
37
|
-
svn_scm = get_core(:svn, url: svn_core.scm.url
|
37
|
+
svn_scm = get_core(:svn, url: "#{svn_core.scm.url}/trunk", branch_name: nil).scm
|
38
38
|
OhlohScm::Svn::Activity.any_instance.stubs(:root).returns(svn_core.scm.url)
|
39
|
-
svn_scm.normalize.branch_name
|
39
|
+
assert_equal svn_scm.normalize.branch_name, '/trunk'
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe 'restrict_url_to_trunk' do
|
44
44
|
it 'must return url when url ends with trunk' do
|
45
45
|
svn_scm = get_core(:svn, url: 'svn:foobar/trunk').scm
|
46
|
-
svn_scm.restrict_url_to_trunk
|
46
|
+
assert_equal svn_scm.restrict_url_to_trunk, svn_scm.url
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'must append trunk to url and set branch_name when trunk folder is present' do
|
50
50
|
with_svn_repository('svn') do |svn_core|
|
51
51
|
scm = svn_core.scm
|
52
|
-
scm.url
|
53
|
-
scm.branch_name
|
52
|
+
assert_equal scm.url, svn_core.activity.root
|
53
|
+
assert_nil scm.branch_name
|
54
54
|
|
55
55
|
scm.restrict_url_to_trunk
|
56
56
|
|
57
|
-
scm.url
|
58
|
-
scm.branch_name
|
57
|
+
assert_equal scm.url, "#{svn_core.activity.root}/trunk"
|
58
|
+
assert_equal scm.branch_name, '/trunk'
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'must update url and branch_name when repo has a single subfolder' do
|
63
63
|
with_svn_repository('svn_subdir') do |svn_core|
|
64
64
|
scm = svn_core.scm
|
65
|
-
scm.url
|
66
|
-
scm.branch_name
|
65
|
+
assert_equal scm.url, svn_core.activity.root
|
66
|
+
assert_nil scm.branch_name
|
67
67
|
|
68
68
|
scm.restrict_url_to_trunk
|
69
69
|
|
70
|
-
scm.url
|
71
|
-
scm.branch_name
|
70
|
+
assert_equal scm.url, "#{svn_core.activity.root}/subdir/trunk"
|
71
|
+
assert_equal scm.branch_name, '/subdir/trunk'
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -51,12 +51,12 @@ describe 'Svn::Status' do
|
|
51
51
|
it 'should validate_server_connection' do
|
52
52
|
with_svn_repository('svn') do |svn|
|
53
53
|
svn.validation.send(:validate_server_connection)
|
54
|
-
svn.validation.errors
|
54
|
+
assert_empty svn.validation.errors
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should strip trailing whitespace in branch_name' do
|
59
|
-
get_core(:svn, branch_name: '/trunk/').scm.normalize.branch_name
|
59
|
+
assert_equal get_core(:svn, branch_name: '/trunk/').scm.normalize.branch_name, '/trunk'
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'should catch exception when validating server connection' do
|
@@ -64,7 +64,7 @@ describe 'Svn::Status' do
|
|
64
64
|
git_svn.validation.instance_variable_set('@errors', nil)
|
65
65
|
git_svn.validation.send :validate_server_connection
|
66
66
|
msg = 'An error occured connecting to the server. Check the URL, username, and password.'
|
67
|
-
git_svn.validation.errors
|
67
|
+
assert_equal git_svn.validation.errors, [[:failed, msg]]
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should validate head token when validating server connection' do
|
@@ -74,7 +74,7 @@ describe 'Svn::Status' do
|
|
74
74
|
git_svn.validation.expects(:url_error)
|
75
75
|
git_svn.validation.send :validate_server_connection
|
76
76
|
msg = "The server did not respond to a 'svn info' command. Is the URL correct?"
|
77
|
-
git_svn.validation.errors
|
77
|
+
assert_equal git_svn.validation.errors, [[:failed, msg]]
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'should validate url when validating server connection' do
|
@@ -83,7 +83,7 @@ describe 'Svn::Status' do
|
|
83
83
|
OhlohScm::Svn::Activity.any_instance.stubs(:head_token).returns('')
|
84
84
|
OhlohScm::Svn::Activity.any_instance.stubs(:root).returns('tt')
|
85
85
|
git_svn.validation.send :validate_server_connection
|
86
|
-
git_svn.validation.errors
|
87
|
-
|
86
|
+
assert_equal git_svn.validation.errors,
|
87
|
+
[[:failed, 'The URL did not match the Subversion root tt. Is the URL correct?']]
|
88
88
|
end
|
89
89
|
end
|
@@ -4,16 +4,16 @@ DATA_DIR = File.expand_path(File.join(File.dirname(__FILE__), '../raw_fixtures')
|
|
4
4
|
|
5
5
|
describe 'SvnParser' do
|
6
6
|
it 'test_empty_array' do
|
7
|
-
OhlohScm::SvnParser.parse('')
|
7
|
+
assert_predicate OhlohScm::SvnParser.parse(''), :empty?
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'test_yield_instead_of_writer' do
|
11
11
|
commits = []
|
12
|
-
result = OhlohScm::SvnParser.parse(File.read(DATA_DIR
|
12
|
+
result = OhlohScm::SvnParser.parse(File.read("#{DATA_DIR}/simple.svn_log")) do |commit|
|
13
13
|
commits << commit.token
|
14
14
|
end
|
15
|
-
result
|
16
|
-
commits
|
15
|
+
assert_nil result
|
16
|
+
assert_equal commits, [5, 4, 3, 2, 1]
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'test_log_parser' do
|
@@ -37,22 +37,22 @@ describe 'SvnParser' do
|
|
37
37
|
revs = OhlohScm::SvnParser.parse(sample_log)
|
38
38
|
|
39
39
|
assert revs
|
40
|
-
revs.size
|
41
|
-
|
42
|
-
revs[0].token
|
43
|
-
revs[0].committer_name
|
44
|
-
revs[0].message
|
45
|
-
revs[0].committer_date
|
46
|
-
|
47
|
-
revs[1].token
|
48
|
-
revs[1].committer_name
|
49
|
-
revs[1].message
|
50
|
-
revs[1].committer_date
|
51
|
-
|
52
|
-
revs[2].token
|
53
|
-
revs[2].committer_name
|
54
|
-
revs[2].message
|
55
|
-
revs[2].committer_date
|
40
|
+
assert_equal revs.size, 3
|
41
|
+
|
42
|
+
assert_equal revs[0].token, 1
|
43
|
+
assert_equal revs[0].committer_name, 'robin'
|
44
|
+
assert_equal revs[0].message, "Initial Checkin\n" # Note \n at end of comment
|
45
|
+
assert_equal revs[0].committer_date, Time.utc(2006, 6, 11, 18, 28, 0o0)
|
46
|
+
|
47
|
+
assert_equal revs[1].token, 2
|
48
|
+
assert_equal revs[1].committer_name, 'jason'
|
49
|
+
assert_equal revs[1].message, 'added makefile' # Note no \n at end of comment
|
50
|
+
assert_equal revs[1].committer_date, Time.utc(2006, 6, 11, 18, 32, 13)
|
51
|
+
|
52
|
+
assert_equal revs[2].token, 3
|
53
|
+
assert_equal revs[2].committer_name, 'robin'
|
54
|
+
assert_equal revs[2].message, 'added some documentation and licensing info'
|
55
|
+
assert_equal revs[2].committer_date, Time.utc(2006, 6, 11, 18, 34, 17)
|
56
56
|
end
|
57
57
|
|
58
58
|
# This is an excerpt from the log for Wireshark. It includes Subversion log excerpts in
|
@@ -95,10 +95,10 @@ describe 'SvnParser' do
|
|
95
95
|
revs = OhlohScm::SvnParser.parse(log)
|
96
96
|
|
97
97
|
assert revs
|
98
|
-
revs.size
|
98
|
+
assert_equal revs.size, 2
|
99
99
|
|
100
|
-
revs[0].token
|
101
|
-
revs[1].token
|
100
|
+
assert_equal revs[0].token, 21_932
|
101
|
+
assert_equal revs[1].token, 21_931
|
102
102
|
|
103
103
|
comment = <<~COMMENT
|
104
104
|
Update from samba tree revision 23054 to 23135
|
@@ -123,7 +123,7 @@ describe 'SvnParser' do
|
|
123
123
|
------------------------------------------------------------------------
|
124
124
|
============================ Samba log end ==============
|
125
125
|
COMMENT
|
126
|
-
revs[0].message
|
126
|
+
assert_equal revs[0].message, comment
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'test_svn_copy' do
|
@@ -137,10 +137,10 @@ describe 'SvnParser' do
|
|
137
137
|
LOG
|
138
138
|
|
139
139
|
commits = OhlohScm::SvnParser.parse(log)
|
140
|
-
commits.size
|
141
|
-
commits.first.diffs.size
|
142
|
-
commits.first.diffs.first.path
|
143
|
-
commits.first.diffs.first.from_path
|
144
|
-
commits.first.diffs.first.from_revision
|
140
|
+
assert_equal commits.size, 1
|
141
|
+
assert_equal commits.first.diffs.size, 1
|
142
|
+
assert_equal commits.first.diffs.first.path, '/trunk'
|
143
|
+
assert_equal commits.first.diffs.first.from_path, '/branches/development'
|
144
|
+
assert_equal commits.first.diffs.first.from_revision, 7
|
145
145
|
end
|
146
146
|
end
|
@@ -7,7 +7,7 @@ describe 'System' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'must raise an exception when command fails' do
|
10
|
-
|
10
|
+
assert_raises(Exception) { run_p('ls /tmp/foobartest') }
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,9 +15,9 @@ describe 'System' do
|
|
15
15
|
it 'must provide error and exitstatus' do
|
16
16
|
cmd = %q(ruby -e" t = 'Hello World'; STDOUT.puts t; STDERR.puts t ")
|
17
17
|
stdout, stderr, status = run_with_error_p(cmd)
|
18
|
-
status.exitstatus
|
19
|
-
stdout
|
20
|
-
stderr
|
18
|
+
assert_equal status.exitstatus, 0
|
19
|
+
assert_equal stdout, "Hello World\n"
|
20
|
+
assert_equal stderr, "Hello World\n"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -26,7 +26,7 @@ describe 'System' do
|
|
26
26
|
level = (1..5).to_a.sample
|
27
27
|
OhlohScm::System.logger.level = level
|
28
28
|
core = OhlohScm::Factory.get_core(scm_type: :git, url: 'foo')
|
29
|
-
core.scm.send(:logger).level
|
29
|
+
assert_equal core.scm.send(:logger).level, level
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/spec/string_encoder_spec.rb
CHANGED
@@ -12,20 +12,20 @@ describe 'string_encoder' do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'preserve length of translated content' do
|
15
|
-
file_path = FIXTURES_DIR
|
15
|
+
file_path = "#{FIXTURES_DIR}/sample-content"
|
16
16
|
original_content_length = File.size(file_path)
|
17
17
|
original_content_lines = File.readlines(file_path).size
|
18
18
|
|
19
|
-
output = `cat #{
|
19
|
+
output = `cat #{file_path} | #{@object.string_encoder}`
|
20
20
|
|
21
21
|
assert_equal original_content_length, output.length
|
22
22
|
assert_equal original_content_lines, output.split("\n").length
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'must convert invalid characters' do
|
26
|
-
invalid_utf8_word_path = FIXTURES_DIR
|
26
|
+
invalid_utf8_word_path = "#{FIXTURES_DIR}/invalid-utf-word"
|
27
27
|
|
28
|
-
string = `cat #{
|
28
|
+
string = `cat #{invalid_utf8_word_path} | #{@object.string_encoder}`
|
29
29
|
|
30
30
|
assert_equal true, string.valid_encoding?
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohloh_scm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenHub Team at Synopsys
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
The OpenHub source control management library for \
|
@@ -186,89 +186,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
186
|
requirements:
|
187
187
|
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
189
|
+
version: 3.0.0
|
190
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
196
|
+
rubygems_version: 3.3.27
|
197
197
|
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: Source Control Management
|
200
|
-
test_files:
|
201
|
-
- spec/.rubocop.yml
|
202
|
-
- spec/benchmarks/hg_bzr_bash_vs_py_api.rb
|
203
|
-
- spec/benchmarks/process_spawn_benchmark.rb
|
204
|
-
- spec/helpers/assert_scm_attr_helper.rb
|
205
|
-
- spec/helpers/commit_tokens_helper.rb
|
206
|
-
- spec/helpers/generic_helper.rb
|
207
|
-
- spec/helpers/repository_helper.rb
|
208
|
-
- spec/helpers/system_helper.rb
|
209
|
-
- spec/ohloh_scm/activity_spec.rb
|
210
|
-
- spec/ohloh_scm/bzr/activity_spec.rb
|
211
|
-
- spec/ohloh_scm/bzr/scm_spec.rb
|
212
|
-
- spec/ohloh_scm/bzr/validation_spec.rb
|
213
|
-
- spec/ohloh_scm/cvs/activity_spec.rb
|
214
|
-
- spec/ohloh_scm/cvs/scm_spec.rb
|
215
|
-
- spec/ohloh_scm/cvs/validation_spec.rb
|
216
|
-
- spec/ohloh_scm/factory_spec.rb
|
217
|
-
- spec/ohloh_scm/git/activity_spec.rb
|
218
|
-
- spec/ohloh_scm/git/scm_spec.rb
|
219
|
-
- spec/ohloh_scm/git/status_spec.rb
|
220
|
-
- spec/ohloh_scm/git/validation_spec.rb
|
221
|
-
- spec/ohloh_scm/git_svn/activity_spec.rb
|
222
|
-
- spec/ohloh_scm/git_svn/scm_spec.rb
|
223
|
-
- spec/ohloh_scm/hg/activity_spec.rb
|
224
|
-
- spec/ohloh_scm/hg/scm_spec.rb
|
225
|
-
- spec/ohloh_scm/hg/status_spec.rb
|
226
|
-
- spec/ohloh_scm/hg/validation_spec.rb
|
227
|
-
- spec/ohloh_scm/parser/array_writer_spec.rb
|
228
|
-
- spec/ohloh_scm/parser/branch_number_spec.rb
|
229
|
-
- spec/ohloh_scm/parser/cvs_parser_spec.rb
|
230
|
-
- spec/ohloh_scm/parser/git_parser_spec.rb
|
231
|
-
- spec/ohloh_scm/parser/hg_parser_spec.rb
|
232
|
-
- spec/ohloh_scm/svn/activity_spec.rb
|
233
|
-
- spec/ohloh_scm/svn/scm_spec.rb
|
234
|
-
- spec/ohloh_scm/svn/validation_spec.rb
|
235
|
-
- spec/ohloh_scm/svn_parser_spec.rb
|
236
|
-
- spec/ohloh_scm/system_spec.rb
|
237
|
-
- spec/ohloh_scm/version_spec.rb
|
238
|
-
- spec/raw_fixtures/basic.rlog
|
239
|
-
- spec/raw_fixtures/file_created_on_branch.rlog
|
240
|
-
- spec/raw_fixtures/invalid-utf-word
|
241
|
-
- spec/raw_fixtures/multiple_revisions.rlog
|
242
|
-
- spec/raw_fixtures/sample-content
|
243
|
-
- spec/raw_fixtures/simple.ohlog
|
244
|
-
- spec/raw_fixtures/simple.svn_log
|
245
|
-
- spec/raw_fixtures/simultaneous_checkins.rlog
|
246
|
-
- spec/raw_fixtures/simultaneous_checkins_2.rlog
|
247
|
-
- spec/scm_fixtures/bzr.tgz
|
248
|
-
- spec/scm_fixtures/bzr_colon.tgz
|
249
|
-
- spec/scm_fixtures/bzr_large.tgz
|
250
|
-
- spec/scm_fixtures/bzr_with_authors.tgz
|
251
|
-
- spec/scm_fixtures/bzr_with_branch.tgz
|
252
|
-
- spec/scm_fixtures/bzr_with_invalid_encoding.tgz
|
253
|
-
- spec/scm_fixtures/bzr_with_nested_branches.tgz
|
254
|
-
- spec/scm_fixtures/bzr_with_subdirectories.tgz
|
255
|
-
- spec/scm_fixtures/cvs.tgz
|
256
|
-
- spec/scm_fixtures/git.tgz
|
257
|
-
- spec/scm_fixtures/git_dupe_delete.tgz
|
258
|
-
- spec/scm_fixtures/git_svn.tgz
|
259
|
-
- spec/scm_fixtures/git_walk.tgz
|
260
|
-
- spec/scm_fixtures/git_with_invalid_encoding.tgz
|
261
|
-
- spec/scm_fixtures/git_with_master_tag.tgz
|
262
|
-
- spec/scm_fixtures/git_with_multiple_branch.tgz
|
263
|
-
- spec/scm_fixtures/git_with_mv.tgz
|
264
|
-
- spec/scm_fixtures/git_with_null_merge.tgz
|
265
|
-
- spec/scm_fixtures/git_with_submodules.tgz
|
266
|
-
- spec/scm_fixtures/hg.tgz
|
267
|
-
- spec/scm_fixtures/hg_dupe_delete.tgz
|
268
|
-
- spec/scm_fixtures/hg_large.tgz
|
269
|
-
- spec/scm_fixtures/hg_walk.tgz
|
270
|
-
- spec/scm_fixtures/hg_with_invalid_encoding.tgz
|
271
|
-
- spec/scm_fixtures/svn.tgz
|
272
|
-
- spec/scm_fixtures/svn_subdir.tgz
|
273
|
-
- spec/spec_helper.rb
|
274
|
-
- spec/string_encoder_spec.rb
|
200
|
+
test_files: []
|