Class: Gitra::TrackedBranch

Inherits:
Object
  • Object
show all
Defined in:
lib/gitra/tracker.rb

Instance Method Summary collapse

Constructor Details

#initialize(git, branch) ⇒ TrackedBranch

Returns a new instance of TrackedBranch.



35
36
37
38
# File 'lib/gitra/tracker.rb', line 35

def initialize(git, branch)
  @git = git
  @branch = branch.to_s
end

Instance Method Details

#commits_since(reference, options = {:ancestry => true}) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/gitra/tracker.rb', line 40

def commits_since(reference, options = {:ancestry => true})
  since = @git.object(reference.to_s)
  base = @git.merge_base(@branch, since)
  if options[:ancestry]
    @git.log_ancestry(base, @branch).reverse
  else
    @git.log(2**16).between(base, @branch).to_a.reverse
  end
end