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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ca7f42fcd9f22befb6a03ef35aeea2fae669bac
4
- data.tar.gz: d8f226bf6718b5cbb3787692e1669d1c6d149e1c
3
+ metadata.gz: 3ae124d155c81e72f0675772b1402466d93754c3
4
+ data.tar.gz: dcfe1fe5c6e6d0d4650682455ab3806c1470a26c
5
5
  SHA512:
6
- metadata.gz: 7911b3775c0bd4898d9bbf1bfcd92772fc38f090858974b6b1b980680ce4d51728832cfde6f71d4188155e489566a3b85ca488b504dca1faea42e53e1a12baa9
7
- data.tar.gz: 10474e25bc367e512ab7eeb51c7f474d46e88cb846a2ca1b2c44ee7db21793d032b85bda4c649fc8ca85d01435d68b0339e3a1f47ef21ecaeb2e3e29be86c4c0
6
+ metadata.gz: 877ab8696d6ee27c2faf3e6ab88e0e60a526bbabd96d6e27dcf3f31b01a799c68cecad611bc891785afaae39403b42b6fbbed9e66e5fbec29b6046f83862d3a8
7
+ data.tar.gz: 4427d117872450bc3f4af78a0414de457119f7731ee13fbbc24d31e68fa3c6e60f107cd0f869b1b831f5d2a558b494234a7ef36d33bafcd3b4e4c2208700ae5c
@@ -1,11 +1,8 @@
1
1
  #!/usr/bin/expect -f
2
2
 
3
- set OPTS [lindex $argv 0]
4
- set URL [lindex $argv 1]
5
-
6
3
  set timeout 10
7
4
 
8
- spawn svn info "$OPTS" "$URL"
5
+ eval spawn [lrange $argv 0 end]
9
6
 
10
7
  expect {
11
8
  "(R)eject, accept (t)emporarily or accept (p)ermanently? " { send "p\r"; }
@@ -11,7 +11,8 @@ module OhlohScm::Adapters
11
11
  private
12
12
 
13
13
  def cat(revision, file_path)
14
- run("cd #{self.url} && git show #{ revision }:\"#{ file_path }\"").strip
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.commit_count(after: 0)
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 = "#{username_opts} #{password_opts}"
48
- opts = '--xml' if opts.strip.empty?
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.commit_count(after: head_token)
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
@@ -1,5 +1,5 @@
1
1
  module OhlohScm
2
2
  module Version
3
- STRING = '2.4.3'
3
+ STRING = '2.4.4'
4
4
  end
5
5
  end
@@ -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.3
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-02-23 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: posix-spawn