ohloh_scm 2.4.3 → 2.4.4
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/bin/accept_svn_ssl_certificate +1 -4
- data/lib/ohloh_scm/adapters/git_svn/cat_file.rb +2 -1
- data/lib/ohloh_scm/adapters/git_svn/commits.rb +7 -0
- data/lib/ohloh_scm/adapters/git_svn/misc.rb +10 -0
- data/lib/ohloh_scm/adapters/git_svn/pull.rb +4 -13
- data/lib/ohloh_scm/version.rb +1 -1
- data/test/unit/git_svn_commits_test.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ae124d155c81e72f0675772b1402466d93754c3
|
4
|
+
data.tar.gz: dcfe1fe5c6e6d0d4650682455ab3806c1470a26c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 877ab8696d6ee27c2faf3e6ab88e0e60a526bbabd96d6e27dcf3f31b01a799c68cecad611bc891785afaae39403b42b6fbbed9e66e5fbec29b6046f83862d3a8
|
7
|
+
data.tar.gz: 4427d117872450bc3f4af78a0414de457119f7731ee13fbbc24d31e68fa3c6e60f107cd0f869b1b831f5d2a558b494234a7ef36d33bafcd3b4e4c2208700ae5c
|
@@ -11,7 +11,8 @@ module OhlohScm::Adapters
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def cat(revision, file_path)
|
14
|
-
|
14
|
+
file_path = %Q{#{file_path}}
|
15
|
+
run("cd #{self.url} && git show #{ revision }:#{ file_path }").strip
|
15
16
|
end
|
16
17
|
|
17
18
|
def git_commit(commit)
|
@@ -5,6 +5,13 @@ module OhlohScm::Adapters
|
|
5
5
|
git_svn_log(cmd: cmd, oneline: true).to_i
|
6
6
|
end
|
7
7
|
|
8
|
+
def source_scm_commit_count(opts={})
|
9
|
+
options = username_and_password_opts(opts[:source_scm])
|
10
|
+
svn_log = run("#{accept_ssl_certificate_cmd} svn info #{options} '#{opts[:source_scm].url}'")
|
11
|
+
svn_log.match(/Revision: ([\d]*)/)
|
12
|
+
$1.to_i - opts[:after].to_i
|
13
|
+
end
|
14
|
+
|
8
15
|
def commits(opts={})
|
9
16
|
parsed_commits = []
|
10
17
|
open_log_file(opts) do |io|
|
@@ -5,6 +5,16 @@ module OhlohScm::Adapters
|
|
5
5
|
run("#{git_svn_log_cmd} #{oneline_flag} #{cmd}").strip
|
6
6
|
end
|
7
7
|
|
8
|
+
def accept_ssl_certificate_cmd
|
9
|
+
File.expand_path('../../../../../bin/accept_svn_ssl_certificate', __FILE__)
|
10
|
+
end
|
11
|
+
|
12
|
+
def username_and_password_opts(source_scm)
|
13
|
+
username = source_scm.username.to_s.empty? ? '' : "--username #{ @source_scm.username }"
|
14
|
+
password = source_scm.password.to_s.empty? ? '' : "--password='#{@source_scm.password}'"
|
15
|
+
"#{username} #{password}"
|
16
|
+
end
|
17
|
+
|
8
18
|
private
|
9
19
|
|
10
20
|
def git_svn_log_cmd
|
@@ -28,7 +28,7 @@ module OhlohScm::Adapters
|
|
28
28
|
prepare_dest_dir
|
29
29
|
accept_certificate_if_prompted
|
30
30
|
|
31
|
-
max_step = @source_scm
|
31
|
+
max_step = source_scm_commit_count(source_scm: @source_scm, after: 0)
|
32
32
|
cmd = "#{password_prompt} git svn clone --quiet #{username_opts} '#{@source_scm.url}' '#{self.url}'"
|
33
33
|
track_conversion(cmd, max_step, &block)
|
34
34
|
end
|
@@ -44,23 +44,14 @@ module OhlohScm::Adapters
|
|
44
44
|
def accept_certificate_if_prompted
|
45
45
|
# git svn does not support non iteractive and serv-certificate options
|
46
46
|
# Permanently accept svn certificate when it prompts
|
47
|
-
opts =
|
48
|
-
|
49
|
-
run "#{accept_ssl_certificate_cmd} '#{opts}' '#{@source_scm.url}'"
|
50
|
-
end
|
51
|
-
|
52
|
-
def accept_ssl_certificate_cmd
|
53
|
-
File.expand_path('../../../../../bin/accept_svn_ssl_certificate', __FILE__)
|
47
|
+
opts = username_and_password_opts(@source_scm)
|
48
|
+
run "#{accept_ssl_certificate_cmd} svn info #{opts} '#{@source_scm.url}'"
|
54
49
|
end
|
55
50
|
|
56
51
|
def password_prompt
|
57
52
|
@source_scm.password.to_s.empty? ? '' : "echo #{ @source_scm.password } |"
|
58
53
|
end
|
59
54
|
|
60
|
-
def password_opts
|
61
|
-
@source_scm.password.to_s.empty? ? '' : "--password='#{@source_scm.password}'"
|
62
|
-
end
|
63
|
-
|
64
55
|
def username_opts
|
65
56
|
@source_scm.username.to_s.empty? ? '' : "--username #{ @source_scm.username }"
|
66
57
|
end
|
@@ -71,7 +62,7 @@ module OhlohScm::Adapters
|
|
71
62
|
end
|
72
63
|
|
73
64
|
def fetch(&block)
|
74
|
-
max_step = @source_scm
|
65
|
+
max_step = source_scm_commit_count(source_scm: @source_scm, after: head_token)
|
75
66
|
cmd = "cd #{self.url} && git svn fetch"
|
76
67
|
track_conversion(cmd, max_step, &block)
|
77
68
|
end
|
data/lib/ohloh_scm/version.rb
CHANGED
@@ -24,5 +24,14 @@ module OhlohScm::Adapters
|
|
24
24
|
assert_equal [1,2,3,5], git_svn.commits.map(&:token)
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
def test_source_scm_commit_count
|
29
|
+
with_svn_repository('svn', 'trunk') do |src|
|
30
|
+
OhlohScm::ScratchDir.new do |dest_dir|
|
31
|
+
git_svn = GitSvnAdapter.new(:url => dest_dir).normalize
|
32
|
+
assert_equal(git_svn.source_scm_commit_count(source_scm: src), 5)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
27
36
|
end
|
28
37
|
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: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BlackDuck Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: posix-spawn
|