module DeepBlame

Constants

VERSION

Public Class Methods

commit_message(sha) click to toggle source
# File lib/deep_blame.rb, line 35
def self.commit_message(sha)
  result = `git show #{sha}`
  result.sub(/\A[\S\s]+^Date.+/,'').sub(/^diff[\S\s]+\Z/,'')
end
display_commit_messages(blame) click to toggle source
# File lib/deep_blame.rb, line 22
def self.display_commit_messages(blame)
  puts "#{blame.short_sha} (#{blame.committed_at.to_date}): #{blame.summary} <#{blame.author}> "
end
display_full_commit_messages(blame) click to toggle source
# File lib/deep_blame.rb, line 30
def self.display_full_commit_messages(blame)
  puts "#{blame.short_sha}: <#{blame.author}>"
  puts commit_message(blame.sha)
end
display_full_concise(blame) click to toggle source
# File lib/deep_blame.rb, line 40
def self.display_full_concise(blame)
  puts "#{blame.short_sha}: <#{blame.author}>"
  message = commit_message(blame.sha)
  puts message.gsub(/\s+/, ' ')
end
display_ids(blame) click to toggle source
# File lib/deep_blame.rb, line 26
def self.display_ids(blame)
  print "#{blame.short_sha} "
end
line_history(path, start_line, end_line = nil, rev = 'HEAD', options) click to toggle source
# File lib/deep_blame.rb, line 5
def self.line_history(path, start_line, end_line = nil, rev = 'HEAD', options)
  blames = Blame.find_recursive_uniq(rev, path, start_line, end_line)
  blames.each do |b|
    case options[:display]
    when "ids"
      display_ids(b)
    when "commits"
      display_commit_messages(b)
    when "full"
      display_full_commit_messages(b)
    else
      display_full_concise(b)
    end
  end
  puts if options[:display] == "ids"
end