added Gitlab::Git::Blame for git blame feature

This commit is contained in:
Dmitriy Zaporozhets 2013-04-01 16:02:54 +03:00
parent 22817398e6
commit 51c167554c

22
lib/gitlab/git/blame.rb Normal file
View file

@ -0,0 +1,22 @@
module Gitlab
module Git
class Blame
attr_accessor :repository, :sha, :path
def initialize(repository, sha, path)
@repository, @sha, @path = repository, sha, path
end
def each
raw_blame = Grit::Blob.blame(repository.repo, sha, path)
raw_blame.each do |commit, lines|
commit = Gitlab::Git::Commit.new(commit)
yield(commit, lines)
end
end
end
end
end