Skip to content

Commit 92e6ec4

Browse files
author
Robin Luckey
committed
OTWO-1206 Ruby 1.9.2 compatibility
No longer compatible with Ruby 1.8.7
1 parent 98133f1 commit 92e6ec4

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require 'rake/clean'
33
require 'rake/testtask'
44

55
require 'rubygems'
6-
require 'rake/gempackagetask'
6+
require 'rubygems/package_task'
77

88
spec = Gem::Specification.new do |s|
99
s.name = 'ohloh_scm'
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
2121
s.test_files = FileList["test/**/*"]
2222
end
2323

24-
Rake::GemPackageTask.new(spec) do |pkg|
24+
Gem::PackageTask.new(spec) do |pkg|
2525
pkg.need_tar = true
2626
pkg.need_zip = true
2727
end

lib/scm/adapters/abstract/sha1.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'sha1'
1+
require 'digest/sha1'
22

33
NULL_SHA1 = '0000000000000000000000000000000000000000' unless defined?(NULL_SHA1)
44

@@ -11,7 +11,7 @@ class AbstractAdapter
1111
# that match those generated natively by Git.
1212

1313
def compute_sha1(blob)
14-
blob.to_s == '' ? NULL_SHA1 : SHA1.sha1("blob #{blob.length}\0#{blob}").to_s
14+
blob.to_s == '' ? NULL_SHA1 : Digest::SHA1.hexdigest("blob #{blob.length}\0#{blob}")
1515
end
1616

1717
# Populates the SHA1 values for each diff in a commit.

lib/scm/adapters/svn/pull.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def svnadmin_create_local
4242
FileUtils.rmdir path
4343
run "svnadmin create #{path}"
4444
FileUtils.cp pre_revprop_change_template, pre_revprop_change_path
45+
FileUtils.chmod 0755, pre_revprop_change_path
4546
end
4647

4748
def svnadmin_create_remote

lib/scm/parsers/bzr_xml_parser.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'parsedate'
21
require 'rexml/document'
32
require 'rexml/streamlistener'
43

lib/scm/parsers/svn_xml_parser.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'parsedate'
21
require 'rexml/document'
32
require 'rexml/streamlistener'
43

@@ -33,7 +32,7 @@ def tag_end(name)
3332
when 'author'
3433
@commit.committer_name = @text
3534
when 'date'
36-
@commit.committer_date = Time.utc(*ParseDate.parsedate(@text))
35+
@commit.committer_date = Time.parse(@text).round.utc
3736
when 'path'
3837
@diff.path = @text
3938
@commit.diffs << @diff

test/unit/svn_commits_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ def test_each_commit
207207
assert_equal [1, 2, 3, 4, 5], commits.collect { |c| c.token }
208208
assert_equal ['robin','robin','robin','jason','jason'], commits.collect { |c| c.committer_name }
209209

210-
assert commits[0].committer_date - Time.utc(2006,6,11,18,28,0) < 1 # commits include milliseconds
211-
assert commits[1].committer_date - Time.utc(2006,6,11,18,32,13) < 1
212-
assert commits[2].committer_date - Time.utc(2006,6,11,18,34,17) < 1
213-
assert commits[3].committer_date - Time.utc(2006,7,14,22,17,8) < 1
214-
assert commits[4].committer_date - Time.utc(2006,7,14,23,7,15) < 1
210+
assert_equal Time.utc(2006,6,11,18,28, 0), commits[0].committer_date
211+
assert_equal Time.utc(2006,6,11,18,32,14), commits[1].committer_date
212+
assert_equal Time.utc(2006,6,11,18,34,18), commits[2].committer_date
213+
assert_equal Time.utc(2006,7,14,22,17, 9), commits[3].committer_date
214+
assert_equal Time.utc(2006,7,14,23, 7,16), commits[4].committer_date
215215

216216
assert_equal "Initial Checkin\n", commits[0].message
217217
assert_equal "added makefile", commits[1].message

test/unit/svn_convert_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_basic_convert
1616
# Because Subversion does not track authors (only committers),
1717
# the Subversion committer becomes the Git author.
1818
assert_equal c.committer_name, dest_commits[i].author_name
19-
assert_equal c.committer_date, dest_commits[i].author_date
19+
assert_equal c.committer_date.round, dest_commits[i].author_date
2020

2121
# The svn-to-git conversion process loses the trailing \n for single-line messages
2222
assert_equal c.message.strip, dest_commits[i].message.strip

0 commit comments

Comments
 (0)