Skip to content

Commit

Permalink
OTWO-4267 Added dependencies configuration and resolved failing test …
Browse files Browse the repository at this point in the history
…cases
  • Loading branch information
aruncsengr committed Jun 10, 2016
1 parent 6699a6d commit 2ea0d4f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
language: ruby
before_install:
- sudo apt-get install -y cvs
- sudo ln -s /usr/bin/cvs /usr/bin/cvsnt
- sudo apt-get install -y subversion
install:
- gem install posix-spawn
- sh .install_dependencies.sh
4 changes: 3 additions & 1 deletion lib/ohloh_scm/adapters/bzr/misc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ def exist?
end

def ls_tree(token)
run("cd #{path} && bzr ls -V -r #{to_rev_param(token)}").split("\n")
run("cd #{path} && bzr ls -V -r #{to_rev_param(token)}").split("\n").map!{ |file_name|
file_name.force_encoding(Encoding::UTF_8)

This comment has been minimized.

Copy link
@notalex

notalex Jun 21, 2016

Ohloh_Scm shouldn't force an encoding on the data(thus changing data). The consumers might be aware of the correct encoding and may wish to handle it accordingly.

}
end

def to_rev_param(r=nil)
Expand Down
4 changes: 3 additions & 1 deletion lib/ohloh_scm/adapters/hg/cat_file.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'shellwords'

module OhlohScm::Adapters
class HgAdapter < AbstractAdapter
def cat_file(commit, diff)
Expand All @@ -20,7 +22,7 @@ def cat(revision, path)
# Example:
# "Foo Bar & Baz" => "Foo\ Bar\ \&\ Baz"
def escape(path)
path.gsub(/[ `'"&()<>|#\$]/) { |c| '\\' + c }
path.shellescape
end
end
end
22 changes: 11 additions & 11 deletions test/unit/cvs_commits_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ class CvsCommitsTest < OhlohScm::Test
def test_commits
with_cvs_repository('cvs', 'simple') do |cvs|

assert_equal ['2006/06/29 16:21:07',
'2006/06/29 18:14:47',
'2006/06/29 18:45:29',
'2006/06/29 18:48:54',
'2006/06/29 18:52:23'], cvs.commits.collect { |c| c.token }

assert_equal ['2006/06/29 18:48:54',
'2006/06/29 18:52:23'],
cvs.commits(:after => '2006/06/29 18:45:29').collect { |c| c.token }
assert_equal ['2006-06-29 16:21:07',
'2006-06-29 18:14:47',
'2006-06-29 18:45:29',
'2006-06-29 18:48:54',
'2006-06-29 18:52:23'], cvs.commits.collect { |c| c.token }

# Make sure we are date format agnostic (2008/01/01 is the same as 2008-01-01)
assert_equal ['2006/06/29 18:48:54',
'2006/06/29 18:52:23'],
assert_equal ['2006-06-29 18:48:54',
'2006-06-29 18:52:23'],
cvs.commits(:after => '2006/06/29 18:45:29').collect { |c| c.token }

assert_equal ['2006-06-29 18:48:54',
'2006-06-29 18:52:23'],
cvs.commits(:after => '2006-06-29 18:45:29').collect { |c| c.token }

assert_equal [], cvs.commits(:after => '2006/06/29 18:52:23').collect { |c| c.token }
Expand Down
2 changes: 1 addition & 1 deletion test/unit/hg_cat_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_funny_file_name_chars
File.open(File.join(dir, funny_name), 'w') { |f| f.write "contents" }

# Add it to an hg repository
`cd #{dir} && hg init && hg add * && hg commit -m test`
`cd #{dir} && hg init && hg add * && hg commit -u tester -m test`

# Confirm that we can read the file back
hg = HgAdapter.new(:url => dir).normalize
Expand Down
2 changes: 1 addition & 1 deletion test/unit/hglib_cat_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_funny_file_name_chars
File.open(File.join(dir, funny_name), 'w') { |f| f.write "contents" }

# Add it to an hg repository
`cd #{dir} && hg init && hg add * && hg commit -m test`
`cd #{dir} && hg init && hg add * && hg commit -u tester -m test`

# Confirm that we can read the file back
hg = HglibAdapter.new(:url => dir).normalize
Expand Down
1 change: 1 addition & 0 deletions test/unit/shellout_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_relative '../test_helper'
require 'timeout'

class ShelloutTest < OhlohScm::Test
def test_execute_must_pipe_the_results_accurately
Expand Down

0 comments on commit 2ea0d4f

Please sign in to comment.