Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing subversion support by chomping and re-enabling long message te…

…st for subversion.
  • Loading branch information...
commit cfcf0a1715fd784ff1bf56a7b833a041af81efbf 1 parent 4d0414e
@jqr jqr authored
View
8 lib/snitch/revisions/git.rb
@@ -1,14 +1,16 @@
class Snitch
module Revisions
class Git < Revision
+ attr_accessor :repository
+
include Message
gem 'mojombo-grit'
require 'mojombo-grit'
def initialize(repository_path, revision = nil)
super
- @repository = Grit::Repo.new(repository_path)
- @commit = revision ? @repository.commit( revision ) : @repository.commits.first
+ self.repository = Grit::Repo.new(repository_path)
+ @commit = revision ? repository.commit( revision ) : repository.commits.first
end
# Only show the first 7 digits of the yucky SHA hash
@@ -21,7 +23,7 @@ def author
end
def project
- @repository.description
+ repository.description
end
def message
View
2  lib/snitch/revisions/subversion.rb
@@ -7,7 +7,7 @@ class Subversion < Revision
def initialize(repository_path, revision)
super
- @svnlook = `which svnlook`
+ @svnlook = `which svnlook`.chomp
end
# Creates a few helper methods for looking at the subversion commit
View
2  test/test_helper.rb
@@ -22,5 +22,5 @@ def expect(expected_value, &block)
def create_subversion_repository_and_checkout
`svnadmin create test-subversion-repository && svn checkout file://$PWD/test-subversion-repository/ test-subversion-checkout && cd ./test-subversion-checkout && touch test && svn add test && svn commit -m 'Initial subversion import.'`
- [`echo $PWD/test-subversion-repository`, `echo $PWD/test-subversion-checkout`]
+ [`echo $PWD/test-subversion-repository`.chomp, `echo $PWD/test-subversion-checkout`.chomp]
end
View
4 test/unit/revisions/git_test.rb
@@ -8,7 +8,7 @@ def setup
end
test 'should have a description' do
- assert_match /^Unnamed repository/, @gitcommit.project
+ assert_match(/^Unnamed repository/, @gitcommit.project)
end
test 'should have diffs' do
@@ -16,7 +16,7 @@ def setup
end
test 'should have a message' do
- assert_equal ' - Initial git import.', @gitcommit.message
+ assert_equal 'Initial git import.', @gitcommit.message
end
test 'should have a commit' do
View
15 test/unit/revisions/subversion_test.rb
@@ -2,7 +2,7 @@
# TODO: move this test to remote folder
-class SubersionTest < Test::Unit::TestCase
+class SubversionTest < Test::Unit::TestCase
def setup
# Creates a test subversion repo locally and makes a test commit to it
repo, checkout = create_subversion_repository_and_checkout
@@ -15,18 +15,15 @@ def setup
test 'should be able to build long message' do
cmt_msg = <<EOF
-[conductor] Revision 100 Committed by deploy:
- - Drop additions
+[snitch] Revision 1 Committed by #{ENV['USER']}:
+ - Initial subversion import.
Changed Files:
- - U trunk/app/controllers/conductor_controller.rb
- - A trunk/app/drops/page_drop.rb
- - U trunk/app/drops/site_drop.rb
- - U trunk/app/models/page.rb
+ - A test
EOF
- assert_equal cmt_msg, @svnlook.to_s(:long)
+ assert_equal cmt_msg, @revision.to_s(:long)
end
-#
+
# test 'should be able to build short message' do
# cmt_msg = "[conductor] Revision 100 Committed by deploy: - Drop additions "
# assert_equal cmt_msg, @svnlook.to_s(:short)
Please sign in to comment.
Something went wrong with that request. Please try again.