ohloh_scm 2.3.5 → 2.4.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/.travis.yml +1 -1
- data/.travis/.install_multiple_scms.sh +3 -3
- data/lib/ohloh_scm.rb +1 -0
- data/lib/ohloh_scm/adapters/git/commits.rb +1 -2
- data/lib/ohloh_scm/adapters/git/misc.rb +2 -2
- data/lib/ohloh_scm/adapters/git_svn/cat_file.rb +21 -0
- data/lib/ohloh_scm/adapters/git_svn/commits.rb +50 -0
- data/lib/ohloh_scm/adapters/git_svn/head.rb +9 -0
- data/lib/ohloh_scm/adapters/git_svn/misc.rb +14 -0
- data/lib/ohloh_scm/adapters/git_svn/pull.rb +82 -0
- data/lib/ohloh_scm/adapters/git_svn_adapter.rb +13 -0
- data/lib/ohloh_scm/version.rb +1 -1
- data/test/repositories/git_svn.tgz +0 -0
- data/test/repositories/git_with_master_tag.tgz +0 -0
- data/test/repositories/svn/db/revprops/6 +12 -0
- data/test/repositories/svn/db/revs/6 +50 -0
- data/test/test_helper.rb +4 -0
- data/test/unit/git_commits_test.rb +14 -0
- data/test/unit/git_misc_test.rb +24 -0
- data/test/unit/git_svn_cat_file_test.rb +57 -0
- data/test/unit/git_svn_commits_test.rb +28 -0
- data/test/unit/git_svn_pull_test.rb +51 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f2741be982e5a3ff6682d155224b0fda48d96d0
|
4
|
+
data.tar.gz: 5c2a84c08c7e2b65c82e6c46bac0239b19457b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9daaef7667bdb94b8a244e462dfc90152c6a36ed3301e4bf9180037a88b8685217ec6495baca24f31d3c6c6c6b2ef1cffe67d45c46338f7c02f7d66eb60ddbc3
|
7
|
+
data.tar.gz: 0e08308d709fa671b3ca42b345f471eaa038eac5b191d22e55f7c3798aa67f97d63a865cd9afab44ff6ec1b7a649de89d1213d20eb719f5a8c0aacefe5e4f3e6
|
data/.travis.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu precise svn18" >> /etc/apt/sources.list.d/subversion18.list'
|
2
|
-
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
|
3
|
-
sudo apt-add-repository -y ppa:git-core/ppa
|
4
1
|
sudo apt-get update
|
2
|
+
sudo pip uninstall mercurial -y
|
5
3
|
sudo apt-get install -y git subversion cvs bzr mercurial
|
6
4
|
sudo ln -s /usr/bin/cvs /usr/bin/cvsnt
|
5
|
+
|
6
|
+
sudo apt-get install git-svn
|
data/lib/ohloh_scm.rb
CHANGED
@@ -19,6 +19,7 @@ require_relative 'ohloh_scm/adapters/hg_adapter'
|
|
19
19
|
require_relative 'ohloh_scm/adapters/hglib_adapter'
|
20
20
|
require_relative 'ohloh_scm/adapters/bzr_adapter'
|
21
21
|
require_relative 'ohloh_scm/adapters/bzrlib_adapter'
|
22
|
+
require_relative 'ohloh_scm/adapters/git_svn_adapter'
|
22
23
|
require_relative 'ohloh_scm/adapters/factory'
|
23
24
|
|
24
25
|
require_relative 'ohloh_scm/parsers/parser'
|
@@ -112,11 +112,10 @@ module OhlohScm::Adapters
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def rev_list_command(opts={})
|
115
|
-
up_to = opts[:up_to] || branch_name
|
115
|
+
up_to = opts[:up_to] || "heads/#{branch_name}"
|
116
116
|
range = opts[:after] ? "#{opts[:after]}..#{up_to}" : up_to
|
117
117
|
|
118
118
|
trunk_only = opts[:trunk_only] ? "--first-parent" : ""
|
119
|
-
|
120
119
|
"cd '#{url}' && git rev-list --topo-order --reverse #{trunk_only} #{range}"
|
121
120
|
end
|
122
121
|
end
|
@@ -36,8 +36,8 @@ module OhlohScm::Adapters
|
|
36
36
|
if FileTest.exist? git_path
|
37
37
|
run "cd '#{url}' && git clean -f -d -x"
|
38
38
|
if self.has_branch?
|
39
|
-
|
40
|
-
|
39
|
+
run "cd '#{url}' && git reset --hard heads/#{self.branch_name} --"
|
40
|
+
run "cd '#{url}' && git checkout #{self.branch_name} --"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OhlohScm::Adapters
|
2
|
+
class GitSvnAdapter < AbstractAdapter
|
3
|
+
def cat_file(commit, diff)
|
4
|
+
cat(git_commit(commit), diff.path)
|
5
|
+
end
|
6
|
+
|
7
|
+
def cat_file_parent(commit, diff)
|
8
|
+
cat("#{ git_commit(commit) }^", diff.path)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def cat(revision, file_path)
|
14
|
+
run("cd #{self.url} && git show #{ revision }:'#{ file_path }'").strip
|
15
|
+
end
|
16
|
+
|
17
|
+
def git_commit(commit)
|
18
|
+
run("cd #{self.url} && git svn find-rev r#{commit.token}").strip
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module OhlohScm::Adapters
|
2
|
+
class GitSvnAdapter < AbstractAdapter
|
3
|
+
def commit_count(opts={})
|
4
|
+
cmd = "#{after_revision(opts)} | wc -l"
|
5
|
+
git_svn_log(cmd: cmd, oneline: true).to_i
|
6
|
+
end
|
7
|
+
|
8
|
+
def commits(opts={})
|
9
|
+
parsed_commits = []
|
10
|
+
open_log_file(opts) do |io|
|
11
|
+
parsed_commits = OhlohScm::Parsers::SvnParser.parse(io)
|
12
|
+
end
|
13
|
+
parsed_commits
|
14
|
+
end
|
15
|
+
|
16
|
+
def commit_tokens(opts={})
|
17
|
+
cmd = "#{after_revision(opts)} | #{extract_revision_number}"
|
18
|
+
git_svn_log(cmd: cmd, oneline: false).split
|
19
|
+
.map(&:to_i)
|
20
|
+
end
|
21
|
+
|
22
|
+
def each_commit(opts={})
|
23
|
+
commits(opts).each do |commit|
|
24
|
+
yield commit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def open_log_file(opts={})
|
31
|
+
cmd = "-v #{ after_revision(opts) } | #{string_encoder} > #{log_filename}"
|
32
|
+
git_svn_log(cmd: cmd, oneline: false)
|
33
|
+
File.open(log_filename, 'r') { |io| yield io }
|
34
|
+
end
|
35
|
+
|
36
|
+
def log_filename
|
37
|
+
File.join('/tmp', url.gsub(/\W/,'') + '.log')
|
38
|
+
end
|
39
|
+
|
40
|
+
def after_revision(opts)
|
41
|
+
next_token = opts[:after].to_i + 1
|
42
|
+
next_head_token = head_token.to_i + 1
|
43
|
+
"-r#{ next_token }:#{ next_head_token }"
|
44
|
+
end
|
45
|
+
|
46
|
+
def extract_revision_number
|
47
|
+
"grep '^r[0-9].*|' | awk -F'|' '{print $1}' | cut -c 2-"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module OhlohScm::Adapters
|
2
|
+
class GitSvnAdapter < AbstractAdapter
|
3
|
+
def git_svn_log(cmd:, oneline:)
|
4
|
+
oneline_flag = '--oneline' if oneline
|
5
|
+
run("#{git_svn_log_cmd} #{oneline_flag} #{cmd}").strip
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def git_svn_log_cmd
|
11
|
+
"cd #{self.url} && git svn log"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module OhlohScm::Adapters
|
2
|
+
class GitSvnAdapter < AbstractAdapter
|
3
|
+
def pull(source_scm, &block)
|
4
|
+
@source_scm = source_scm
|
5
|
+
convert_to_git(&block)
|
6
|
+
end
|
7
|
+
|
8
|
+
def branch_name
|
9
|
+
'master'
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def convert_to_git(&block)
|
15
|
+
yield(0, 1) if block_given?
|
16
|
+
|
17
|
+
if FileTest.exist?(git_path)
|
18
|
+
fetch(&block)
|
19
|
+
else
|
20
|
+
clone(&block)
|
21
|
+
end
|
22
|
+
|
23
|
+
clean_up_disk
|
24
|
+
end
|
25
|
+
|
26
|
+
def clone(&block)
|
27
|
+
prepare_dest_dir
|
28
|
+
accept_certificate_if_prompted
|
29
|
+
|
30
|
+
max_step = @source_scm.commit_count(after: 0)
|
31
|
+
cmd = "#{password_prompt} git svn clone --quiet #{username_opts} '#{@source_scm.url}' '#{self.url}'"
|
32
|
+
track_conversion(cmd, max_step, &block)
|
33
|
+
end
|
34
|
+
|
35
|
+
def track_conversion(cmd, max_step)
|
36
|
+
count = 0
|
37
|
+
IO.popen(cmd).each do |line|
|
38
|
+
yield(count += 1, max_step) if line.match(/^r\d+/) && block_given?
|
39
|
+
end
|
40
|
+
yield(max_step, max_step) if block_given?
|
41
|
+
end
|
42
|
+
|
43
|
+
def accept_certificate_if_prompted
|
44
|
+
# git svn does not support non iteractive and serv-certificate options
|
45
|
+
# Permanently accept svn certificate when it prompts
|
46
|
+
run "echo p | svn info #{username_opts} #{password_opts} '#{ @source_scm.url }'"
|
47
|
+
end
|
48
|
+
|
49
|
+
def password_prompt
|
50
|
+
@source_scm.password.to_s.empty? ? '' : "echo #{ @source_scm.password } |"
|
51
|
+
end
|
52
|
+
|
53
|
+
def password_opts
|
54
|
+
@source_scm.password.to_s.empty? ? '' : "--password='#{@source_scm.password}'"
|
55
|
+
end
|
56
|
+
|
57
|
+
def username_opts
|
58
|
+
@source_scm.username.to_s.empty? ? '' : "--username #{ @source_scm.username }"
|
59
|
+
end
|
60
|
+
|
61
|
+
def prepare_dest_dir
|
62
|
+
FileUtils.mkdir_p(self.url)
|
63
|
+
FileUtils.rmdir(self.url)
|
64
|
+
end
|
65
|
+
|
66
|
+
def fetch(&block)
|
67
|
+
max_step = @source_scm.commit_count(after: head_token)
|
68
|
+
cmd = "cd #{self.url} && git svn fetch"
|
69
|
+
track_conversion(cmd, max_step, &block)
|
70
|
+
end
|
71
|
+
|
72
|
+
def git_path
|
73
|
+
File.join(self.url, '/.git')
|
74
|
+
end
|
75
|
+
|
76
|
+
def clean_up_disk
|
77
|
+
if FileTest.exist?(self.url)
|
78
|
+
run("cd #{self.url} && find . -maxdepth 1 -not -name .git -not -name . -print0 | xargs -0 rm -rf --")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module OhlohScm::Adapters
|
2
|
+
class GitSvnAdapter < AbstractAdapter
|
3
|
+
def english_name
|
4
|
+
'Subversion'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require_relative 'git_svn/pull'
|
10
|
+
require_relative 'git_svn/commits'
|
11
|
+
require_relative 'git_svn/misc'
|
12
|
+
require_relative 'git_svn/cat_file'
|
13
|
+
require_relative 'git_svn/head'
|
data/lib/ohloh_scm/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -0,0 +1,50 @@
|
|
1
|
+
d: 1.2.r6/0
|
2
|
+
type: dir
|
3
|
+
pred: 1.0.r5/303
|
4
|
+
count: 4
|
5
|
+
text: 5 151 139 139 f64dae99765c4ad6dd4f923d5c122b03
|
6
|
+
cpath: /tags/1.0
|
7
|
+
copyfrom: 5 /trunk
|
8
|
+
|
9
|
+
PLAIN
|
10
|
+
K 3
|
11
|
+
1.0
|
12
|
+
V 12
|
13
|
+
dir 1.2.r6/0
|
14
|
+
END
|
15
|
+
ENDREP
|
16
|
+
id: 4.0.r6/182
|
17
|
+
type: dir
|
18
|
+
pred: 4.0.r1/451
|
19
|
+
count: 1
|
20
|
+
text: 6 139 30 0 4b8b1915f3fd6f5914139e8a6b8fc54a
|
21
|
+
cpath: /tags
|
22
|
+
copyroot: 0 /
|
23
|
+
|
24
|
+
PLAIN
|
25
|
+
K 8
|
26
|
+
branches
|
27
|
+
V 14
|
28
|
+
dir 3.0.r1/385
|
29
|
+
K 4
|
30
|
+
tags
|
31
|
+
V 14
|
32
|
+
dir 4.0.r6/182
|
33
|
+
K 5
|
34
|
+
trunk
|
35
|
+
V 14
|
36
|
+
dir 1.0.r5/303
|
37
|
+
END
|
38
|
+
ENDREP
|
39
|
+
id: 0.0.r6/420
|
40
|
+
type: dir
|
41
|
+
pred: 0.0.r5/545
|
42
|
+
count: 6
|
43
|
+
text: 6 311 96 0 5b746b19220ac4681a4112dd6ebaeabd
|
44
|
+
cpath: /
|
45
|
+
copyroot: 0 /
|
46
|
+
|
47
|
+
1._0.t5-1 add false false /tags/1.0
|
48
|
+
5 /trunk
|
49
|
+
|
50
|
+
420 545
|
data/test/test_helper.rb
CHANGED
@@ -105,6 +105,10 @@ class OhlohScm::Test < Test::Unit::TestCase
|
|
105
105
|
with_repository(OhlohScm::Adapters::GitAdapter, name, branch_name) { |git| yield git }
|
106
106
|
end
|
107
107
|
|
108
|
+
def with_git_svn_repository(name)
|
109
|
+
with_repository(OhlohScm::Adapters::GitSvnAdapter, name) { |svn| yield svn }
|
110
|
+
end
|
111
|
+
|
108
112
|
def with_hg_repository(name, branch_name = nil)
|
109
113
|
with_repository(OhlohScm::Adapters::HgAdapter, name, branch_name) { |hg| yield hg }
|
110
114
|
end
|
@@ -161,5 +161,19 @@ module OhlohScm::Adapters
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
164
|
+
|
165
|
+
def test_commit_count_having_tagname_master
|
166
|
+
with_git_repository('git_with_master_tag') do |git|
|
167
|
+
assert_equal 3, git.commit_count
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_commit_tokens_having_tagname_master
|
172
|
+
with_git_repository('git_with_master_tag') do |git|
|
173
|
+
assert_equal ['57b2bd30b7bae970cb3b374a0c05fd6ec3088ebf',
|
174
|
+
'4e95717ac8cff8cdb10d83398d3ac667a2cca341',
|
175
|
+
'34b8a99e6e5dd39bc36893f71e0ab1685668731f'], git.commit_tokens
|
176
|
+
end
|
177
|
+
end
|
164
178
|
end
|
165
179
|
end
|
data/test/unit/git_misc_test.rb
CHANGED
@@ -12,6 +12,24 @@ module OhlohScm::Adapters
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
def test_export_works_identically_for_tag_or_commit_sha
|
16
|
+
with_git_repository('git') do |git|
|
17
|
+
tag_sha = 'f6e5a894ac4173f8f2a200f2c36df38a1e61121a'
|
18
|
+
commit_sha = `cd #{ git.url } && git show #{ tag_sha }`.slice(/commit (.+)$/, 1)
|
19
|
+
|
20
|
+
OhlohScm::ScratchDir.new do |tag_dir|
|
21
|
+
git.export(tag_dir, tag_sha)
|
22
|
+
|
23
|
+
OhlohScm::ScratchDir.new do |commit_dir|
|
24
|
+
git.export(commit_dir, commit_sha)
|
25
|
+
|
26
|
+
assert_equal '', `diff -rq #{ tag_dir } #{ commit_dir }`
|
27
|
+
assert_equal ['.','..','.gitignore','helloworld.c','makefile','ohloh_token'], Dir.entries(commit_dir).sort
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
15
33
|
def test_branches
|
16
34
|
with_git_repository('git') do |git|
|
17
35
|
assert_equal ['develop', 'master'], git.branches
|
@@ -72,5 +90,11 @@ module OhlohScm::Adapters
|
|
72
90
|
assert_equal git.tags, []
|
73
91
|
end
|
74
92
|
end
|
93
|
+
|
94
|
+
def test_tags_having_tagname_master
|
95
|
+
with_git_repository('git_with_master_tag') do |git|
|
96
|
+
assert_equal git.tags, [['master', '4e95717ac8cff8cdb10d83398d3ac667a2cca341', Time.parse('2018-02-01T12:56:48+0530')]]
|
97
|
+
end
|
98
|
+
end
|
75
99
|
end
|
76
100
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
module OhlohScm::Adapters
|
4
|
+
class GitSvnCatFileTest < OhlohScm::Test
|
5
|
+
def test_cat_file
|
6
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
7
|
+
expected = <<-EXPECTED.gsub(/^\s+/, '')
|
8
|
+
/* Hello, World! */
|
9
|
+
#include <stdio.h>
|
10
|
+
main()
|
11
|
+
{
|
12
|
+
printf("Hello, World!\\n");
|
13
|
+
}
|
14
|
+
EXPECTED
|
15
|
+
|
16
|
+
assert_equal expected.strip, git_svn.cat_file(OhlohScm::Commit.new(token: 1),
|
17
|
+
OhlohScm::Diff.new(path: 'helloworld.c')).gsub(/\t/, '').strip
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_cat_file_with_non_existent_token
|
22
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
23
|
+
assert git_svn.cat_file(OhlohScm::Commit.new(token: 999), OhlohScm::Diff.new(path: 'helloworld.c'))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_cat_file_with_invalid_filename
|
28
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
29
|
+
assert_raise RuntimeError do
|
30
|
+
git_svn.cat_file(OhlohScm::Commit.new(token: 1), OhlohScm::Diff.new(path: 'invalid'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_cat_file_parent
|
36
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
37
|
+
expected = <<-EXPECTED.gsub(/^\s+/, '')
|
38
|
+
/* Hello, World! */
|
39
|
+
#include <stdio.h>
|
40
|
+
main()
|
41
|
+
{
|
42
|
+
printf("Hello, World!\\n");
|
43
|
+
}
|
44
|
+
EXPECTED
|
45
|
+
|
46
|
+
assert_equal expected.strip, git_svn.cat_file_parent(OhlohScm::Commit.new(token: 2),
|
47
|
+
OhlohScm::Diff.new(path: 'helloworld.c')).gsub(/\t/, '')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_cat_file_parent_with_first_token
|
52
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
53
|
+
assert git_svn.cat_file(OhlohScm::Commit.new(token: 1), OhlohScm::Diff.new(path: 'helloworld.c'))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
module OhlohScm::Adapters
|
4
|
+
class GitSvnCommitsTest < OhlohScm::Test
|
5
|
+
def test_commit_tokens
|
6
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
7
|
+
assert_equal [1,2,3,5], git_svn.commit_tokens
|
8
|
+
assert_equal [3,5], git_svn.commit_tokens(after: 2)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_commits
|
13
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
14
|
+
assert_equal [1,2,3,5], git_svn.commits.map(&:token)
|
15
|
+
assert_equal [3,5], git_svn.commits(after: 2).map(&:token)
|
16
|
+
assert_equal [], git_svn.commits(after: 7)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_each_commit
|
21
|
+
with_git_svn_repository('git_svn') do |git_svn|
|
22
|
+
commits = []
|
23
|
+
git_svn.each_commit { |c| commits << c }
|
24
|
+
assert_equal [1,2,3,5], git_svn.commits.map(&:token)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
module OhlohScm::Adapters
|
4
|
+
class GitSvnPullTest < OhlohScm::Test
|
5
|
+
def test_svn_conversion_on_pull
|
6
|
+
with_svn_repository('svn', 'trunk') do |src|
|
7
|
+
OhlohScm::ScratchDir.new do |dest_dir|
|
8
|
+
dest = GitSvnAdapter.new(:url => dest_dir).normalize
|
9
|
+
|
10
|
+
dest.pull(src)
|
11
|
+
|
12
|
+
dest_commits = dest.commits
|
13
|
+
assert_equal dest_commits.map(&:diffs).flatten.map(&:path),
|
14
|
+
["helloworld.c", "makefile", "README", "helloworld.c", "COPYING"]
|
15
|
+
assert_equal dest_commits.map(&:committer_date).map(&:to_s),
|
16
|
+
['2006-06-11 18:28:00 UTC', '2006-06-11 18:32:13 UTC', '2006-06-11 18:34:17 UTC', '2006-07-14 23:07:15 UTC']
|
17
|
+
|
18
|
+
src.commits.each_with_index do |c, i|
|
19
|
+
assert_equal c.committer_name, dest_commits[i].committer_name
|
20
|
+
assert_equal c.message.strip, dest_commits[i].message.strip
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_updated_branch_on_fetch
|
27
|
+
branch_name = 'trunk'
|
28
|
+
|
29
|
+
with_svn_repository('svn', branch_name) do |source_scm|
|
30
|
+
OhlohScm::ScratchDir.new do |dest_dir|
|
31
|
+
OhlohScm::ScratchDir.new do |svn_working_folder|
|
32
|
+
git_svn = GitSvnAdapter.new(:url => dest_dir).normalize
|
33
|
+
git_svn.pull(source_scm)
|
34
|
+
assert_equal 4, git_svn.commit_count
|
35
|
+
|
36
|
+
message = 'new commit'
|
37
|
+
source_scm_db_path = source_scm.path.sub('trunk', 'db')
|
38
|
+
system "cd #{ svn_working_folder } && svn co #{ source_scm.url } && cd #{ branch_name } &&
|
39
|
+
mkdir -p #{ source_scm_db_path }/transactions &&
|
40
|
+
touch one && svn add one && svn commit -m '#{ message }' && svn update"
|
41
|
+
|
42
|
+
git_svn.pull(source_scm)
|
43
|
+
|
44
|
+
assert_equal 5, git_svn.commit_count
|
45
|
+
assert_equal message, git_svn.commits.last.message.chomp
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
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
|
+
version: 2.4.0
|
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-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: posix-spawn
|
@@ -120,6 +120,12 @@ files:
|
|
120
120
|
- lib/ohloh_scm/adapters/git/token.rb
|
121
121
|
- lib/ohloh_scm/adapters/git/validation.rb
|
122
122
|
- lib/ohloh_scm/adapters/git_adapter.rb
|
123
|
+
- lib/ohloh_scm/adapters/git_svn/cat_file.rb
|
124
|
+
- lib/ohloh_scm/adapters/git_svn/commits.rb
|
125
|
+
- lib/ohloh_scm/adapters/git_svn/head.rb
|
126
|
+
- lib/ohloh_scm/adapters/git_svn/misc.rb
|
127
|
+
- lib/ohloh_scm/adapters/git_svn/pull.rb
|
128
|
+
- lib/ohloh_scm/adapters/git_svn_adapter.rb
|
123
129
|
- lib/ohloh_scm/adapters/hg/cat_file.rb
|
124
130
|
- lib/ohloh_scm/adapters/hg/commits.rb
|
125
131
|
- lib/ohloh_scm/adapters/hg/head.rb
|
@@ -448,9 +454,11 @@ files:
|
|
448
454
|
- test/repositories/deep_svn/locks/db.lock
|
449
455
|
- test/repositories/git.tgz
|
450
456
|
- test/repositories/git_dupe_delete.tgz
|
457
|
+
- test/repositories/git_svn.tgz
|
451
458
|
- test/repositories/git_walk.tgz
|
452
459
|
- test/repositories/git_with_empty_merge.tgz
|
453
460
|
- test/repositories/git_with_invalid_encoding.tgz
|
461
|
+
- test/repositories/git_with_master_tag.tgz
|
454
462
|
- test/repositories/git_with_null_merge.tgz
|
455
463
|
- test/repositories/hg.tgz
|
456
464
|
- test/repositories/hg_dupe_delete.tgz
|
@@ -469,12 +477,14 @@ files:
|
|
469
477
|
- test/repositories/svn/db/revprops/3
|
470
478
|
- test/repositories/svn/db/revprops/4
|
471
479
|
- test/repositories/svn/db/revprops/5
|
480
|
+
- test/repositories/svn/db/revprops/6
|
472
481
|
- test/repositories/svn/db/revs/0
|
473
482
|
- test/repositories/svn/db/revs/1
|
474
483
|
- test/repositories/svn/db/revs/2
|
475
484
|
- test/repositories/svn/db/revs/3
|
476
485
|
- test/repositories/svn/db/revs/4
|
477
486
|
- test/repositories/svn/db/revs/5
|
487
|
+
- test/repositories/svn/db/revs/6
|
478
488
|
- test/repositories/svn/db/uuid
|
479
489
|
- test/repositories/svn/db/write-lock
|
480
490
|
- test/repositories/svn/format
|
@@ -579,6 +589,9 @@ files:
|
|
579
589
|
- test/unit/git_push_test.rb
|
580
590
|
- test/unit/git_rev_list_test.rb
|
581
591
|
- test/unit/git_styled_parser_test.rb
|
592
|
+
- test/unit/git_svn_cat_file_test.rb
|
593
|
+
- test/unit/git_svn_commits_test.rb
|
594
|
+
- test/unit/git_svn_pull_test.rb
|
582
595
|
- test/unit/git_token_test.rb
|
583
596
|
- test/unit/git_validation_test.rb
|
584
597
|
- test/unit/hg_cat_file_test.rb
|
@@ -912,9 +925,11 @@ test_files:
|
|
912
925
|
- test/repositories/deep_svn/locks/db.lock
|
913
926
|
- test/repositories/git.tgz
|
914
927
|
- test/repositories/git_dupe_delete.tgz
|
928
|
+
- test/repositories/git_svn.tgz
|
915
929
|
- test/repositories/git_walk.tgz
|
916
930
|
- test/repositories/git_with_empty_merge.tgz
|
917
931
|
- test/repositories/git_with_invalid_encoding.tgz
|
932
|
+
- test/repositories/git_with_master_tag.tgz
|
918
933
|
- test/repositories/git_with_null_merge.tgz
|
919
934
|
- test/repositories/hg.tgz
|
920
935
|
- test/repositories/hg_dupe_delete.tgz
|
@@ -933,12 +948,14 @@ test_files:
|
|
933
948
|
- test/repositories/svn/db/revprops/3
|
934
949
|
- test/repositories/svn/db/revprops/4
|
935
950
|
- test/repositories/svn/db/revprops/5
|
951
|
+
- test/repositories/svn/db/revprops/6
|
936
952
|
- test/repositories/svn/db/revs/0
|
937
953
|
- test/repositories/svn/db/revs/1
|
938
954
|
- test/repositories/svn/db/revs/2
|
939
955
|
- test/repositories/svn/db/revs/3
|
940
956
|
- test/repositories/svn/db/revs/4
|
941
957
|
- test/repositories/svn/db/revs/5
|
958
|
+
- test/repositories/svn/db/revs/6
|
942
959
|
- test/repositories/svn/db/uuid
|
943
960
|
- test/repositories/svn/db/write-lock
|
944
961
|
- test/repositories/svn/format
|
@@ -1043,6 +1060,9 @@ test_files:
|
|
1043
1060
|
- test/unit/git_push_test.rb
|
1044
1061
|
- test/unit/git_rev_list_test.rb
|
1045
1062
|
- test/unit/git_styled_parser_test.rb
|
1063
|
+
- test/unit/git_svn_cat_file_test.rb
|
1064
|
+
- test/unit/git_svn_commits_test.rb
|
1065
|
+
- test/unit/git_svn_pull_test.rb
|
1046
1066
|
- test/unit/git_token_test.rb
|
1047
1067
|
- test/unit/git_validation_test.rb
|
1048
1068
|
- test/unit/hg_cat_file_test.rb
|