##// END OF EJS Templates
Changeset comments are now stripped before being stored in the database (patch by Nicholas Wieland)....
Jean-Philippe Lang -
r651:c754e017dcc4
parent child
Show More
@@ -25,6 +25,10 class Changeset < ActiveRecord::Base
25 25 validates_uniqueness_of :revision, :scope => :repository_id
26 26 validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
27 27
28 def comments=(comment)
29 write_attribute(:comments, comment.strip)
30 end
31
28 32 def committed_on=(date)
29 33 self.commit_date = date
30 34 super
@@ -53,4 +53,19 class RepositoryTest < Test::Unit::TestCase
53 53 # ignoring commits referencing an issue of another project
54 54 assert_equal [], Issue.find(4).changesets
55 55 end
56
57 def test_for_changeset_comments_strip
58 repository = Repository::Mercurial.create( :project => Project.find( 4 ), :url => '/foo/bar/baz' )
59 comment = <<-COMMENT
60 This is a loooooooooooooooooooooooooooong comment
61
62
63 COMMENT
64 changeset = Changeset.new(
65 :comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c',
66 :committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository_id => repository )
67 assert( changeset.save )
68 assert_not_equal( comment, changeset.comments )
69 assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )
70 end
56 71 end
General Comments 0
You need to be logged in to leave comments. Login now