# Finds and returns a revision with a number or the beginning of a hash
def find_changeset_by_name(name)
+ return nil if name.nil? || name.empty?
if /[^\d]/ =~ name or name.to_s.size > 8
e = changesets.find(:first, :conditions => ['scmid = ?', name.to_s])
else
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /watcher =/ }
end
+
+ def test_empty_revision
+ @repository.fetch_changesets
+ @repository.reload
+ ['', ' ', nil].each do |r|
+ get :revision, :id => 1, :rev => r
+ assert_response 500
+ assert_error_tag :content => /was not found/
+ end
+ end
else
puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
def test_fake; assert true end
assert_equal '2:400bb8672109', c.format_identifier
end
+ def test_find_changeset_by_empty_name
+ @repository.fetch_changesets
+ @repository.reload
+ ['', ' ', nil].each do |r|
+ assert_nil @repository.find_changeset_by_name(r)
+ end
+ end
+
def test_activities
c = Changeset.new(:repository => @repository,
:committed_on => Time.now,