2013-02-25 23:28:11 -05:00
|
|
|
require "grit"
|
|
|
|
|
2013-03-07 01:42:30 -05:00
|
|
|
module Network
|
2013-02-25 23:28:11 -05:00
|
|
|
class Commit
|
|
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
|
2013-03-07 03:56:01 -05:00
|
|
|
attr_reader :refs
|
|
|
|
attr_accessor :time, :spaces, :parent_spaces
|
2013-02-25 23:28:11 -05:00
|
|
|
|
2013-03-07 03:56:01 -05:00
|
|
|
def initialize(raw_commit, refs)
|
2013-03-31 11:49:58 -04:00
|
|
|
@commit = Gitlab::Git::Commit.new(raw_commit)
|
2013-02-25 23:28:11 -05:00
|
|
|
@time = -1
|
2013-02-27 08:37:38 -05:00
|
|
|
@spaces = []
|
2013-02-25 23:28:11 -05:00
|
|
|
@parent_spaces = []
|
2013-03-07 03:56:01 -05:00
|
|
|
@refs = refs || []
|
2013-02-25 23:28:11 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(m, *args, &block)
|
2013-03-07 03:56:01 -05:00
|
|
|
@commit.send(m, *args, &block)
|
2013-02-25 23:28:11 -05:00
|
|
|
end
|
2013-02-27 08:37:38 -05:00
|
|
|
|
|
|
|
def space
|
|
|
|
if @spaces.size > 0
|
|
|
|
@spaces.first
|
|
|
|
else
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
2013-03-07 06:36:40 -05:00
|
|
|
|
|
|
|
def parents(map)
|
|
|
|
@commit.parents.map do |p|
|
|
|
|
if map.include?(p.id)
|
|
|
|
map[p.id]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
.compact
|
|
|
|
end
|
2013-02-25 23:28:11 -05:00
|
|
|
end
|
|
|
|
end
|