ohloh_scm 2.0.0 → 2.0.1
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.
- data/lib/ohloh_scm/adapters/svn/commits.rb +1 -1
- data/lib/ohloh_scm/commit.rb +1 -1
- data/lib/ohloh_scm/diff.rb +4 -4
- data/lib/ohloh_scm/parsers/bzr_parser.rb +4 -4
- data/lib/ohloh_scm/parsers/bzr_xml_parser.rb +13 -13
- data/lib/ohloh_scm/parsers/cvs_parser.rb +1 -1
- data/lib/ohloh_scm/parsers/git_parser.rb +2 -2
- data/lib/ohloh_scm/parsers/git_styled_parser.rb +2 -2
- data/lib/ohloh_scm/parsers/hg_parser.rb +2 -2
- data/lib/ohloh_scm/parsers/hg_styled_parser.rb +2 -2
- data/lib/ohloh_scm/parsers/svn_parser.rb +2 -2
- data/lib/ohloh_scm/parsers/svn_xml_parser.rb +2 -2
- data/lib/ohloh_scm/scratch_dir.rb +1 -1
- data/lib/ohloh_scm/version.rb +2 -2
- data/ohloh_scm.gemspec +1 -1
- data/test/test_helper.rb +2 -2
- data/test/unit/abstract_adapter_test.rb +4 -4
- data/test/unit/adapter_factory_test.rb +7 -7
- data/test/unit/array_writer_test.rb +1 -1
- data/test/unit/bzr_cat_file_test.rb +12 -12
- data/test/unit/bzr_commits_test.rb +12 -12
- data/test/unit/bzr_head_test.rb +1 -1
- data/test/unit/bzr_misc_test.rb +2 -2
- data/test/unit/bzr_parser_test.rb +5 -5
- data/test/unit/bzr_pull_test.rb +2 -2
- data/test/unit/bzr_push_test.rb +2 -2
- data/test/unit/bzr_validation_test.rb +3 -3
- data/test/unit/bzr_xml_parser_test.rb +20 -20
- data/test/unit/bzrlib_cat_file_test.rb +10 -10
- data/test/unit/bzrlib_head_test.rb +1 -1
- data/test/unit/cvs_branch_number_test.rb +1 -1
- data/test/unit/cvs_commits_test.rb +1 -1
- data/test/unit/cvs_convert_test.rb +2 -2
- data/test/unit/cvs_misc_test.rb +1 -1
- data/test/unit/cvs_parser_test.rb +1 -1
- data/test/unit/cvs_validation_test.rb +1 -1
- data/test/unit/git_cat_file_test.rb +2 -2
- data/test/unit/git_commit_all_test.rb +3 -3
- data/test/unit/git_commits_test.rb +1 -1
- data/test/unit/git_head_test.rb +1 -1
- data/test/unit/git_log_parser_test.rb +2 -2
- data/test/unit/git_misc_test.rb +4 -4
- data/test/unit/git_parser_test.rb +1 -1
- data/test/unit/git_patch_test.rb +1 -1
- data/test/unit/git_pull_test.rb +2 -2
- data/test/unit/git_push_test.rb +3 -3
- data/test/unit/git_rev_list_test.rb +1 -1
- data/test/unit/git_styled_parser_test.rb +4 -4
- data/test/unit/git_token_test.rb +6 -6
- data/test/unit/git_validation_test.rb +1 -1
- data/test/unit/hg_cat_file_test.rb +6 -6
- data/test/unit/hg_commits_test.rb +1 -1
- data/test/unit/hg_head_test.rb +1 -1
- data/test/unit/hg_misc_test.rb +2 -2
- data/test/unit/hg_parser_test.rb +1 -1
- data/test/unit/hg_patch_test.rb +1 -1
- data/test/unit/hg_pull_test.rb +2 -2
- data/test/unit/hg_push_test.rb +2 -2
- data/test/unit/hg_rev_list_test.rb +1 -1
- data/test/unit/hg_validation_test.rb +1 -1
- data/test/unit/hglib_cat_file_test.rb +6 -6
- data/test/unit/hglib_head_test.rb +1 -1
- data/test/unit/ohlog_command_line_test.rb +1 -1
- data/test/unit/shellout_test.rb +1 -1
- data/test/unit/string_encoder_command_line_test.rb +1 -1
- data/test/unit/svn_cat_file_test.rb +3 -3
- data/test/unit/svn_chain_cat_file_test.rb +3 -3
- data/test/unit/svn_chain_commits_test.rb +1 -1
- data/test/unit/svn_chain_test.rb +2 -2
- data/test/unit/svn_commits_test.rb +15 -15
- data/test/unit/svn_convert_test.rb +2 -2
- data/test/unit/svn_head_test.rb +1 -1
- data/test/unit/svn_misc_test.rb +2 -2
- data/test/unit/svn_parser_test.rb +1 -1
- data/test/unit/svn_patch_test.rb +1 -1
- data/test/unit/svn_pull_test.rb +5 -5
- data/test/unit/svn_push_test.rb +3 -3
- data/test/unit/svn_validation_test.rb +3 -3
- data/test/unit/svn_xml_parser_test.rb +2 -2
- metadata +2 -2
@@ -96,7 +96,7 @@ module OhlohScm::Adapters
|
|
96
96
|
if (diff.action == 'D' or diff.action == 'A') && is_directory?(diff.path, recurse_rev)
|
97
97
|
# Deleting or adding a directory. Expand it out to show every file.
|
98
98
|
recurse_files(diff.path, recurse_rev).collect do |f|
|
99
|
-
|
99
|
+
OhlohScm::Diff.new(:action => diff.action, :path => File.join(diff.path, f))
|
100
100
|
end
|
101
101
|
else
|
102
102
|
# An ordinary file action. Just return the diff.
|
data/lib/ohloh_scm/commit.rb
CHANGED
data/lib/ohloh_scm/diff.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module OhlohScm
|
2
2
|
# A +Diff+ represents a change to a single file. It can represent the addition or
|
3
3
|
# deletion of a file, or it can represent a modification of the file contents.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Ohloh does not track filename changes. If a file is renamed, Ohloh treats this
|
6
6
|
# as the deletion of one file and the creation of another.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# Ohloh does not track directories, only the files within directories.
|
9
9
|
#
|
10
10
|
# Don't confuse our use of the word "Diff" with a patch file or the output of the
|
@@ -22,7 +22,7 @@ module Scm
|
|
22
22
|
# 'M' modified
|
23
23
|
# 'D' deleted
|
24
24
|
attr_accessor :action
|
25
|
-
|
25
|
+
|
26
26
|
# The SHA1 hash of the file contents both before and after the change.
|
27
27
|
# These must be computed using the same method as Git.
|
28
28
|
attr_accessor :parent_sha1, :sha1
|
@@ -30,7 +30,7 @@ module OhlohScm::Parsers
|
|
30
30
|
e.diffs = remove_dupes(e.diffs)
|
31
31
|
yield e
|
32
32
|
end
|
33
|
-
e =
|
33
|
+
e = OhlohScm::Commit.new
|
34
34
|
e.diffs = []
|
35
35
|
next_state = :data
|
36
36
|
when /^#{indent}revno:\s+(\d+)$/
|
@@ -98,10 +98,10 @@ module OhlohScm::Parsers
|
|
98
98
|
# Note that is possible to be renamed to the empty string!
|
99
99
|
# This happens when a subdirectory is moved to become the root.
|
100
100
|
before, after = line.scan(/(.+) => ?(.*)/).first
|
101
|
-
[
|
102
|
-
|
101
|
+
[ OhlohScm::Diff.new(:action => 'D', :path => before),
|
102
|
+
OhlohScm::Diff.new(:action => 'A', :path => after || '' )]
|
103
103
|
else
|
104
|
-
[
|
104
|
+
[OhlohScm::Diff.new(:action => action, :path => line)]
|
105
105
|
end.each do |d|
|
106
106
|
d.path = strip_trailing_asterisk(d.path)
|
107
107
|
end
|
@@ -18,7 +18,7 @@ module OhlohScm::Parsers
|
|
18
18
|
def tag_start(name, attrs)
|
19
19
|
case name
|
20
20
|
when 'log'
|
21
|
-
@commit =
|
21
|
+
@commit = OhlohScm::Commit.new
|
22
22
|
@commit.diffs = []
|
23
23
|
when 'affected-files'
|
24
24
|
@diffs = []
|
@@ -87,18 +87,18 @@ module OhlohScm::Parsers
|
|
87
87
|
case action
|
88
88
|
# A rename action requires two diffs: one to remove the old filename,
|
89
89
|
# another to add the new filename.
|
90
|
-
#
|
90
|
+
#
|
91
91
|
# Note that is possible to be renamed to the empty string!
|
92
92
|
# This happens when a subdirectory is moved to become the root.
|
93
93
|
when 'renamed'
|
94
|
-
diffs = [
|
95
|
-
|
94
|
+
diffs = [ OhlohScm::Diff.new(:action => 'D', :path => before_path),
|
95
|
+
OhlohScm::Diff.new(:action => 'A', :path => path || '')]
|
96
96
|
when 'added'
|
97
|
-
diffs = [
|
97
|
+
diffs = [OhlohScm::Diff.new(:action => 'A', :path => path)]
|
98
98
|
when 'modified'
|
99
|
-
diffs = [
|
99
|
+
diffs = [OhlohScm::Diff.new(:action => 'M', :path => path)]
|
100
100
|
when 'removed'
|
101
|
-
diffs = [
|
101
|
+
diffs = [OhlohScm::Diff.new(:action => 'D', :path => path)]
|
102
102
|
end
|
103
103
|
diffs.each do |d|
|
104
104
|
d.path = strip_trailing_asterisk(d.path)
|
@@ -108,11 +108,11 @@ module OhlohScm::Parsers
|
|
108
108
|
|
109
109
|
def strip_trailing_asterisk(path)
|
110
110
|
path[-1..-1] == '*' ? path[0..-2] : path
|
111
|
-
end
|
111
|
+
end
|
112
112
|
|
113
113
|
def remove_dupes(diffs)
|
114
114
|
BzrXmlParser.remove_dupes(diffs)
|
115
|
-
end
|
115
|
+
end
|
116
116
|
|
117
117
|
end
|
118
118
|
|
@@ -133,14 +133,14 @@ module OhlohScm::Parsers
|
|
133
133
|
def self.remove_dupes(diffs)
|
134
134
|
# Bazaar may report that a file was added and modified in a single commit.
|
135
135
|
# Reduce these cases to a single 'A' action.
|
136
|
-
diffs.delete_if do |d|
|
136
|
+
diffs.delete_if do |d|
|
137
137
|
d.action == 'M' && diffs.select { |x| x.path == d.path && x.action == 'A' }.any?
|
138
|
-
end
|
138
|
+
end
|
139
139
|
|
140
140
|
# Bazaar may report that a file was both deleted and added in a single commit.
|
141
141
|
# Reduce these cases to a single 'M' action.
|
142
|
-
diffs.each do |d|
|
143
|
-
d.action = 'M' if diffs.select { |x| x.path == d.path }.size > 1
|
142
|
+
diffs.each do |d|
|
143
|
+
d.action = 'M' if diffs.select { |x| x.path == d.path }.size > 1
|
144
144
|
end.uniq
|
145
145
|
end
|
146
146
|
|
@@ -139,7 +139,7 @@ module OhlohScm::Parsers
|
|
139
139
|
should_yield = false if commit_number == '1.1' and state == 'dead'
|
140
140
|
message = read_message(io)
|
141
141
|
if should_yield
|
142
|
-
commit =
|
142
|
+
commit = OhlohScm::Commit.new
|
143
143
|
commit.token = committer_date[0..18]
|
144
144
|
commit.committer_date = Time.parse(committer_date[0..18] + ' +0000').utc
|
145
145
|
commit.committer_name = committer_name
|
@@ -27,7 +27,7 @@ module OhlohScm::Parsers
|
|
27
27
|
when /^commit ([a-z0-9]{40,40})$/
|
28
28
|
sha1 = $1
|
29
29
|
yield e if e
|
30
|
-
e =
|
30
|
+
e = OhlohScm::Commit.new
|
31
31
|
e.diffs = []
|
32
32
|
e.token = sha1
|
33
33
|
e.author_name = ANONYMOUS
|
@@ -53,7 +53,7 @@ module OhlohScm::Parsers
|
|
53
53
|
|
54
54
|
elsif state == :diffs
|
55
55
|
if line =~ /^([ADM])\t(.+)$/
|
56
|
-
e.diffs <<
|
56
|
+
e.diffs << OhlohScm::Diff.new( :action => $1, :path => $2)
|
57
57
|
end
|
58
58
|
|
59
59
|
else
|
@@ -35,7 +35,7 @@ module OhlohScm::Parsers
|
|
35
35
|
if line =~ /^Commit: ([a-z0-9]+)$/
|
36
36
|
sha1 = $1
|
37
37
|
yield e if e
|
38
|
-
e =
|
38
|
+
e = OhlohScm::Commit.new
|
39
39
|
e.diffs = []
|
40
40
|
e.token = sha1
|
41
41
|
e.author_name = ANONYMOUS
|
@@ -70,7 +70,7 @@ module OhlohScm::Parsers
|
|
70
70
|
elsif line =~ /:([0-9]+) ([0-9]+) ([a-z0-9]+) ([a-z0-9]+) ([A-Z])\t"?(.+[^"])"?$/
|
71
71
|
# Submodules have a file mode of '160000', which indicates a "gitlink"
|
72
72
|
# We ignore submodules completely.
|
73
|
-
e.diffs <<
|
73
|
+
e.diffs << OhlohScm::Diff.new( :action => $5, :path => $6, :sha1 => $4, :parent_sha1 => $3 ) unless $1=='160000' || $2=='160000'
|
74
74
|
end
|
75
75
|
|
76
76
|
else
|
@@ -17,7 +17,7 @@ module OhlohScm::Parsers
|
|
17
17
|
case l
|
18
18
|
when /^changeset:\s+\d+:([0-9a-f]+)/
|
19
19
|
yield e if e && block_given?
|
20
|
-
e =
|
20
|
+
e = OhlohScm::Commit.new
|
21
21
|
e.diffs = []
|
22
22
|
e.token = $1
|
23
23
|
when /^user:\s+(.+?)(\s+<(.+)>)?$/
|
@@ -27,7 +27,7 @@ module OhlohScm::Parsers
|
|
27
27
|
e.committer_date = Time.parse($1).utc
|
28
28
|
when /^files:\s+(.+)/
|
29
29
|
($1 || '').split(' ').each do |file|
|
30
|
-
e.diffs <<
|
30
|
+
e.diffs << OhlohScm::Diff.new(:action => '?', :path => file)
|
31
31
|
end
|
32
32
|
when /^summary:\s+(.+)/
|
33
33
|
e.message = $1
|
@@ -25,7 +25,7 @@ module OhlohScm::Parsers
|
|
25
25
|
if state == :data
|
26
26
|
case l
|
27
27
|
when /^changeset:\s+([0-9a-f]+)/
|
28
|
-
e =
|
28
|
+
e = OhlohScm::Commit.new
|
29
29
|
e.diffs = []
|
30
30
|
e.token = $1
|
31
31
|
when /^user:\s+(.+?)(\s+<(.+)>)?$/
|
@@ -46,7 +46,7 @@ module OhlohScm::Parsers
|
|
46
46
|
if l == "__END_FILES__\n"
|
47
47
|
next_state = :data
|
48
48
|
elsif l =~ /^([MAD]) (.+)$/
|
49
|
-
e.diffs <<
|
49
|
+
e.diffs << OhlohScm::Diff.new(:action => $1, :path => $2)
|
50
50
|
end
|
51
51
|
|
52
52
|
elsif state == :long_comment
|
@@ -13,7 +13,7 @@ module OhlohScm::Parsers
|
|
13
13
|
next_state = state
|
14
14
|
if state == :data
|
15
15
|
if l =~ /^r(\d+) \| (.*) \| (\d+-\d+-\d+ .*) \(.*\) \| .*/
|
16
|
-
e =
|
16
|
+
e = OhlohScm::Commit.new
|
17
17
|
e.token = $1.to_i
|
18
18
|
e.committer_name = $2
|
19
19
|
e.committer_date = Time.parse($3).utc
|
@@ -26,7 +26,7 @@ module OhlohScm::Parsers
|
|
26
26
|
elsif state == :diffs
|
27
27
|
if l =~ /^ (\w) ([^\(\)]+)( \(from (.+):(\d+)\))?$/
|
28
28
|
e.diffs ||= []
|
29
|
-
e.diffs <<
|
29
|
+
e.diffs << OhlohScm::Diff.new(:action => $1, :path => $2, :from_path => $4, :from_revision => $5.to_i)
|
30
30
|
else
|
31
31
|
next_state = :comment
|
32
32
|
end
|
@@ -15,11 +15,11 @@ module OhlohScm::Parsers
|
|
15
15
|
def tag_start(name, attrs)
|
16
16
|
case name
|
17
17
|
when 'logentry'
|
18
|
-
@commit =
|
18
|
+
@commit = OhlohScm::Commit.new
|
19
19
|
@commit.diffs = []
|
20
20
|
@commit.token = attrs['revision'].to_i
|
21
21
|
when 'path'
|
22
|
-
@diff =
|
22
|
+
@diff = OhlohScm::Diff.new(:action => attrs['action'],
|
23
23
|
:from_path => attrs['copyfrom-path'],
|
24
24
|
:from_revision => attrs['copyfrom-rev'].to_i)
|
25
25
|
end
|
data/lib/ohloh_scm/version.rb
CHANGED
data/ohloh_scm.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'ohloh_scm/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'ohloh_scm'
|
7
|
-
gem.version =
|
7
|
+
gem.version = OhlohScm::Version::STRING
|
8
8
|
gem.authors = ["BlackDuck Software"]
|
9
9
|
gem.email = ["info@openhub.net"]
|
10
10
|
gem.summary = %[Source Control Management]
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,7 @@ unless defined?(DATA_DIR)
|
|
17
17
|
DATA_DIR = File.expand_path(File.join(TEST_DIR, 'data'))
|
18
18
|
end
|
19
19
|
|
20
|
-
class
|
20
|
+
class OhlohScm::Test < Test::Unit::TestCase
|
21
21
|
# For reasons unknown, the base class defines a default_test method to throw a failure.
|
22
22
|
# We override it with a no-op to prevent this 'helpful' feature.
|
23
23
|
def default_test
|
@@ -48,7 +48,7 @@ class Scm::Test < Test::Unit::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def with_repository(type, name)
|
51
|
-
|
51
|
+
OhlohScm::ScratchDir.new do |dir|
|
52
52
|
if Dir.entries(REPO_DIR).include?(name)
|
53
53
|
`cp -R #{File.join(REPO_DIR, name)} #{dir}`
|
54
54
|
elsif Dir.entries(REPO_DIR).include?(name + '.tgz')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
|
3
3
|
module OhlohScm::Adapters
|
4
|
-
class AbstractAdapterTest <
|
4
|
+
class AbstractAdapterTest < OhlohScm::Test
|
5
5
|
def test_simple_validation
|
6
6
|
scm = AbstractAdapter.new()
|
7
7
|
assert !scm.valid?
|
@@ -74,7 +74,7 @@ module OhlohScm::Adapters
|
|
74
74
|
stdout = AbstractAdapter.run(cmd)
|
75
75
|
assert_equal "Hello World\n", stdout
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
def test_shellout_with_stderr
|
79
79
|
cmd = %q( ruby -e" t = 'Hello World'; STDOUT.puts t; STDERR.puts t " )
|
80
80
|
stdout, stderr, status = AbstractAdapter.run_with_err(cmd)
|
@@ -82,7 +82,7 @@ module OhlohScm::Adapters
|
|
82
82
|
assert_equal "Hello World\n", stdout
|
83
83
|
assert_equal "Hello World\n", stderr
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
def test_shellout_large_output
|
87
87
|
cat = 'ruby -e" puts Array.new(65536){ 42 } "'
|
88
88
|
stdout = AbstractAdapter.run(cat)
|
@@ -91,7 +91,7 @@ module OhlohScm::Adapters
|
|
91
91
|
|
92
92
|
def test_shellout_error
|
93
93
|
cmd = "false"
|
94
|
-
assert_raise RuntimeError do
|
94
|
+
assert_raise RuntimeError do
|
95
95
|
stdout = AbstractAdapter.run(cmd)
|
96
96
|
end
|
97
97
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
|
3
3
|
module OhlohScm::Adapters
|
4
|
-
class FactoryTest <
|
4
|
+
class FactoryTest < OhlohScm::Test
|
5
5
|
|
6
6
|
def test_factory_hg
|
7
|
-
|
7
|
+
OhlohScm::ScratchDir.new do |path|
|
8
8
|
`cd #{path} && hg init`
|
9
9
|
hg = Factory.from_path(path)
|
10
10
|
assert hg.is_a?(HgAdapter)
|
@@ -13,7 +13,7 @@ module OhlohScm::Adapters
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_factory_bzr
|
16
|
-
|
16
|
+
OhlohScm::ScratchDir.new do |path|
|
17
17
|
`cd #{path} && bzr init`
|
18
18
|
bzr = Factory.from_path(path)
|
19
19
|
assert bzr.is_a?(BzrAdapter)
|
@@ -22,7 +22,7 @@ module OhlohScm::Adapters
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_factory_git
|
25
|
-
|
25
|
+
OhlohScm::ScratchDir.new do |path|
|
26
26
|
`cd #{path} && git init`
|
27
27
|
git = Factory.from_path(path)
|
28
28
|
assert git.is_a?(GitAdapter)
|
@@ -31,7 +31,7 @@ module OhlohScm::Adapters
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_factory_svn
|
34
|
-
|
34
|
+
OhlohScm::ScratchDir.new do |path|
|
35
35
|
`cd #{path} && svnadmin create foo`
|
36
36
|
svn = Factory.from_path(File.join(path, 'foo'))
|
37
37
|
assert svn.is_a?(SvnAdapter)
|
@@ -40,7 +40,7 @@ module OhlohScm::Adapters
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_factory_svn_checkout
|
43
|
-
|
43
|
+
OhlohScm::ScratchDir.new do |path|
|
44
44
|
`cd #{path} && svnadmin create foo`
|
45
45
|
`cd #{path} && svn co file://#{File.expand_path(File.join(path, 'foo'))} bar`
|
46
46
|
svn = Factory.from_path(File.join(path, 'bar'))
|
@@ -53,7 +53,7 @@ module OhlohScm::Adapters
|
|
53
53
|
|
54
54
|
def test_factory_from_cvs_checkout
|
55
55
|
with_cvs_repository('cvs', 'simple') do |cvs|
|
56
|
-
|
56
|
+
OhlohScm::ScratchDir.new do |path|
|
57
57
|
`cd #{path} && cvsnt -d #{File.expand_path(cvs.url)} co simple 2> /dev/null`
|
58
58
|
factory_response = Factory.from_path(File.join(path, 'simple'))
|
59
59
|
assert factory_response.is_a?(CvsAdapter)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require_relative '../test_helper'
|
3
3
|
|
4
4
|
module OhlohScm::Adapters
|
5
|
-
class BzrCatFileTest <
|
5
|
+
class BzrCatFileTest < OhlohScm::Test
|
6
6
|
|
7
7
|
def test_cat_file
|
8
8
|
with_bzr_repository('bzr') do |bzr|
|
@@ -11,12 +11,12 @@ first file
|
|
11
11
|
second line
|
12
12
|
EXPECTED
|
13
13
|
assert_equal expected,
|
14
|
-
bzr.cat_file(
|
15
|
-
|
14
|
+
bzr.cat_file(OhlohScm::Commit::new(:token => 6),
|
15
|
+
OhlohScm::Diff.new(:path => "file1.txt"))
|
16
16
|
|
17
17
|
# file2.txt has been removed in commit #5
|
18
18
|
assert_equal nil, bzr.cat_file(bzr.head,
|
19
|
-
|
19
|
+
OhlohScm::Diff.new(:path => "file2.txt"))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -27,10 +27,10 @@ first file
|
|
27
27
|
second line
|
28
28
|
EXPECTED
|
29
29
|
assert_equal expected,
|
30
|
-
bzr.cat_file(
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
30
|
+
bzr.cat_file(OhlohScm::Commit::new(:token => 7),
|
31
|
+
OhlohScm::Diff.new(:path => "Cédric.txt"))
|
32
|
+
end
|
33
|
+
end
|
34
34
|
|
35
35
|
def test_cat_file_parent
|
36
36
|
with_bzr_repository('bzr') do |bzr|
|
@@ -39,16 +39,16 @@ first file
|
|
39
39
|
second line
|
40
40
|
EXPECTED
|
41
41
|
assert_equal expected,
|
42
|
-
bzr.cat_file_parent(
|
43
|
-
|
42
|
+
bzr.cat_file_parent(OhlohScm::Commit::new(:token => 6),
|
43
|
+
OhlohScm::Diff.new(:path => "file1.txt"))
|
44
44
|
|
45
45
|
# file2.txt has been removed in commit #5
|
46
46
|
expected = <<-EXPECTED
|
47
47
|
another file
|
48
48
|
EXPECTED
|
49
49
|
assert_equal expected,
|
50
|
-
bzr.cat_file_parent(
|
51
|
-
|
50
|
+
bzr.cat_file_parent(OhlohScm::Commit.new(:token => 5),
|
51
|
+
OhlohScm::Diff.new(:path => "file2.txt"))
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|