gitlabhq/app/models/commit.rb

50 lines
637 B
Ruby
Raw Normal View History

2011-11-20 22:32:12 +02:00
class Commit
2012-01-28 16:47:55 +02:00
include ActiveModel::Conversion
extend ActiveModel::Naming
2011-11-27 17:35:49 +02:00
attr_accessor :commit
attr_accessor :head
attr_accessor :refs
2011-11-27 17:35:49 +02:00
delegate :message,
:committed_date,
:parents,
:sha,
:date,
:author,
:message,
:diffs,
:tree,
:id,
:to => :commit
2012-01-28 16:47:55 +02:00
def persisted?
false
end
2011-11-27 17:35:49 +02:00
def initialize(raw_commit, head = nil)
@commit = raw_commit
@head = head
end
2012-01-29 12:04:09 +02:00
def safe_message
2011-12-30 21:41:39 +08:00
message
2011-11-27 17:35:49 +02:00
end
def created_at
committed_date
end
def author_email
2011-12-30 21:41:39 +08:00
author.email
2011-11-27 17:35:49 +02:00
end
def author_name
2011-12-30 21:41:39 +08:00
author.name
2011-11-27 17:35:49 +02:00
end
2011-11-29 20:06:37 +02:00
def prev_commit
parents.first
end
2011-11-20 22:32:12 +02:00
end