Skip to content

Commit 89d7d75

Browse files
darcs_support: change Scm to OhlohScm
1 parent 3f89184 commit 89d7d75

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/ohloh_scm/parsers/darcs_parser.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def self.internal_parse(buffer, opts)
1717
case l
1818
when /^patch ([0-9a-f]*)/
1919
yield e if e && block_given?
20-
e = Scm::Commit.new
20+
e = OhlohScm::Commit.new
2121
e.diffs = []
2222
e.token = $1
2323
when /^Author: (.*)/
@@ -42,13 +42,13 @@ def self.internal_parse(buffer, opts)
4242
elsif state == :long_comment_or_prims
4343
case l
4444
when /^ addfile\s+(.+)/
45-
e.diffs << Scm::Diff.new(:action => 'A', :path => $1)
45+
e.diffs << OhlohScm::Diff.new(:action => 'A', :path => $1)
4646
next_state = :prims
4747
when /^ rmfile\s+(.+)/
48-
e.diffs << Scm::Diff.new(:action => 'D', :path => $1)
48+
e.diffs << OhlohScm::Diff.new(:action => 'D', :path => $1)
4949
next_state = :prims
5050
when /^ hunk\s+(.+)\s+([0-9]+)$/
51-
e.diffs << Scm::Diff.new(:action => 'M', :path => $1)
51+
e.diffs << OhlohScm::Diff.new(:action => 'M', :path => $1)
5252
# e.sha1, e.parent_sha1 = ...
5353
next_state = :prims
5454
when /^$/
@@ -61,11 +61,11 @@ def self.internal_parse(buffer, opts)
6161
elsif state == :prims
6262
case l
6363
when /^ addfile\s+(.+)/
64-
e.diffs << Scm::Diff.new(:action => 'A', :path => $1)
64+
e.diffs << OhlohScm::Diff.new(:action => 'A', :path => $1)
6565
when /^ rmfile\s+(.+)/
66-
e.diffs << Scm::Diff.new(:action => 'D', :path => $1)
66+
e.diffs << OhlohScm::Diff.new(:action => 'D', :path => $1)
6767
when /^ hunk\s+(.+)\s+([0-9]+)$/
68-
e.diffs << Scm::Diff.new(:action => 'M', :path => $1)
68+
e.diffs << OhlohScm::Diff.new(:action => 'M', :path => $1)
6969
# e.sha1, e.parent_sha1 = ...
7070
when /^$/
7171
next_state = :patch

test/unit/darcs_cat_file_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ def test_cat_file
2121
EXPECTED
2222

2323
# The file was deleted by the "remove..." patch. Check that it does not exist now, but existed in parent.
24-
assert_equal nil, darcs.cat_file(Scm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), Scm::Diff.new(:path => 'helloworld.c'))
25-
assert_equal expected, darcs.cat_file_parent(Scm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), Scm::Diff.new(:path => 'helloworld.c'))
26-
assert_equal expected, darcs.cat_file(Scm::Commit.new(:token => 'bd7e455d648b784ce4be2db26a4e62dfe734dd66'), Scm::Diff.new(:path => 'helloworld.c'))
24+
assert_equal nil, darcs.cat_file(OhlohScm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), OhlohScm::Diff.new(:path => 'helloworld.c'))
25+
assert_equal expected, darcs.cat_file_parent(OhlohScm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), OhlohScm::Diff.new(:path => 'helloworld.c'))
26+
assert_equal expected, darcs.cat_file(OhlohScm::Commit.new(:token => 'bd7e455d648b784ce4be2db26a4e62dfe734dd66'), OhlohScm::Diff.new(:path => 'helloworld.c'))
2727
end
2828
end
2929

3030
# Ensure that we escape bash-significant characters like ' and & when they appear in the filename
3131
# NB only works with --reserved-ok, otherwise darcs rejects with "invalid under Windows"
3232
def test_funny_file_name_chars
33-
Scm::ScratchDir.new do |dir|
33+
OhlohScm::ScratchDir.new do |dir|
3434
# Make a file with a problematic filename
3535
funny_name = '|file_name (&\'")'
3636
File.open(File.join(dir, funny_name), 'w') { |f| f.write "contents" }
@@ -40,7 +40,7 @@ def test_funny_file_name_chars
4040
darcs.run("cd #{dir} && darcs init && darcs add --reserved-ok * && darcs record -a -m test")
4141

4242
# Confirm that we can read the file back
43-
assert_equal "contents", darcs.cat_file(darcs.head, Scm::Diff.new(:path => funny_name))
43+
assert_equal "contents", darcs.cat_file(darcs.head, OhlohScm::Diff.new(:path => funny_name))
4444
end
4545
end
4646

0 commit comments

Comments
 (0)