class Bringit::Compare
Attributes
base[R]
head[R]
straight[R]
Public Class Methods
new(repository, base, head, straight = false)
click to toggle source
# File lib/bringit/compare.rb, line 5 def initialize(repository, base, head, straight = false) @repository = repository @straight = straight unless base && head @commits = [] return end @base = Bringit::Commit.find(repository, base.try(:strip)) @head = Bringit::Commit.find(repository, head.try(:strip)) @commits = [] unless @base && @head @commits = [] if same end
Public Instance Methods
commits()
click to toggle source
# File lib/bringit/compare.rb, line 25 def commits return @commits if defined?(@commits) @commits = Bringit::Commit.between(@repository, @base.id, @head.id) end
diffs(options = {})
click to toggle source
# File lib/bringit/compare.rb, line 31 def diffs(options = {}) unless @head && @base return Bringit::DiffCollection.new([]) end paths = options.delete(:paths) || [] options[:straight] = @straight Bringit::Diff.between(@repository, @head.id, @base.id, options, *paths) end
same()
click to toggle source
# File lib/bringit/compare.rb, line 21 def same @base && @head && @base.id == @head.id end