Class: Bugwatch::ExceptionTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/bugwatch/exception_tracker.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ ExceptionTracker

Returns a new instance of ExceptionTracker.



35
36
37
# File 'lib/bugwatch/exception_tracker.rb', line 35

def initialize(repo)
  @repo = repo
end

Instance Method Details

#discover(begin_sha, exception_data, end_sha = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/bugwatch/exception_tracker.rb', line 39

def discover(begin_sha, exception_data, end_sha=nil)
  commits = @repo.commits(begin_sha)
  exception_commit = commits.first
  exception_sources = exception_data.backtrace.map {|(file, line)| exception_commit.identify(file, line.to_i) }
  commits_in_range(commits, end_sha).select do |commit|
    diffs(commit, exception_data).any? do |diff|
      exception_sources.any? {|exception_source| touched_exception?(diff.modifications, exception_source) }
    end
  end
end