From 89d7d750afb9ca990fdf9772161ece9fe7c4c625 Mon Sep 17 00:00:00 2001 From: Andreas Wagner Date: Sun, 31 Jul 2016 13:04:36 -0400 Subject: [PATCH] darcs_support: change Scm to OhlohScm --- lib/ohloh_scm/parsers/darcs_parser.rb | 14 +++++++------- test/unit/darcs_cat_file_test.rb | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/ohloh_scm/parsers/darcs_parser.rb b/lib/ohloh_scm/parsers/darcs_parser.rb index 5ce4279e..6fcfb2b8 100644 --- a/lib/ohloh_scm/parsers/darcs_parser.rb +++ b/lib/ohloh_scm/parsers/darcs_parser.rb @@ -17,7 +17,7 @@ def self.internal_parse(buffer, opts) case l when /^patch ([0-9a-f]*)/ yield e if e && block_given? - e = Scm::Commit.new + e = OhlohScm::Commit.new e.diffs = [] e.token = $1 when /^Author: (.*)/ @@ -42,13 +42,13 @@ def self.internal_parse(buffer, opts) elsif state == :long_comment_or_prims case l when /^ addfile\s+(.+)/ - e.diffs << Scm::Diff.new(:action => 'A', :path => $1) + e.diffs << OhlohScm::Diff.new(:action => 'A', :path => $1) next_state = :prims when /^ rmfile\s+(.+)/ - e.diffs << Scm::Diff.new(:action => 'D', :path => $1) + e.diffs << OhlohScm::Diff.new(:action => 'D', :path => $1) next_state = :prims when /^ hunk\s+(.+)\s+([0-9]+)$/ - e.diffs << Scm::Diff.new(:action => 'M', :path => $1) + e.diffs << OhlohScm::Diff.new(:action => 'M', :path => $1) # e.sha1, e.parent_sha1 = ... next_state = :prims when /^$/ @@ -61,11 +61,11 @@ def self.internal_parse(buffer, opts) elsif state == :prims case l when /^ addfile\s+(.+)/ - e.diffs << Scm::Diff.new(:action => 'A', :path => $1) + e.diffs << OhlohScm::Diff.new(:action => 'A', :path => $1) when /^ rmfile\s+(.+)/ - e.diffs << Scm::Diff.new(:action => 'D', :path => $1) + e.diffs << OhlohScm::Diff.new(:action => 'D', :path => $1) when /^ hunk\s+(.+)\s+([0-9]+)$/ - e.diffs << Scm::Diff.new(:action => 'M', :path => $1) + e.diffs << OhlohScm::Diff.new(:action => 'M', :path => $1) # e.sha1, e.parent_sha1 = ... when /^$/ next_state = :patch diff --git a/test/unit/darcs_cat_file_test.rb b/test/unit/darcs_cat_file_test.rb index 78b2b74a..2c99bac8 100644 --- a/test/unit/darcs_cat_file_test.rb +++ b/test/unit/darcs_cat_file_test.rb @@ -21,16 +21,16 @@ def test_cat_file EXPECTED # The file was deleted by the "remove..." patch. Check that it does not exist now, but existed in parent. - assert_equal nil, darcs.cat_file(Scm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), Scm::Diff.new(:path => 'helloworld.c')) - assert_equal expected, darcs.cat_file_parent(Scm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), Scm::Diff.new(:path => 'helloworld.c')) - assert_equal expected, darcs.cat_file(Scm::Commit.new(:token => 'bd7e455d648b784ce4be2db26a4e62dfe734dd66'), Scm::Diff.new(:path => 'helloworld.c')) + assert_equal nil, darcs.cat_file(OhlohScm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), OhlohScm::Diff.new(:path => 'helloworld.c')) + assert_equal expected, darcs.cat_file_parent(OhlohScm::Commit.new(:token => '1007b5ad4831769283213d47e1fd5f6d30ac97f0'), OhlohScm::Diff.new(:path => 'helloworld.c')) + assert_equal expected, darcs.cat_file(OhlohScm::Commit.new(:token => 'bd7e455d648b784ce4be2db26a4e62dfe734dd66'), OhlohScm::Diff.new(:path => 'helloworld.c')) end end # Ensure that we escape bash-significant characters like ' and & when they appear in the filename # NB only works with --reserved-ok, otherwise darcs rejects with "invalid under Windows" def test_funny_file_name_chars - Scm::ScratchDir.new do |dir| + OhlohScm::ScratchDir.new do |dir| # Make a file with a problematic filename funny_name = '|file_name (&\'")' File.open(File.join(dir, funny_name), 'w') { |f| f.write "contents" } @@ -40,7 +40,7 @@ def test_funny_file_name_chars darcs.run("cd #{dir} && darcs init && darcs add --reserved-ok * && darcs record -a -m test") # Confirm that we can read the file back - assert_equal "contents", darcs.cat_file(darcs.head, Scm::Diff.new(:path => funny_name)) + assert_equal "contents", darcs.cat_file(darcs.head, OhlohScm::Diff.new(:path => funny_name)) end end