Class: Churn::GitAnalyzer

Inherits:
SourceControl show all
Defined in:
lib/churn/scm/git_analyzer.rb

Overview

analizes git SCM to find recently changed files, and what lines have been altered

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SourceControl

#get_updated_files_change_info, #get_updated_files_from_log, #initialize, set_source_control

Constructor Details

This class inherits a constructor from Churn::SourceControl

Class Method Details

.supported?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/churn/scm/git_analyzer.rb', line 6

def self.supported?
  !!(`git branch 2>&1` && $?.success?)
end

Instance Method Details

#get_commit_historyObject



18
19
20
# File 'lib/churn/scm/git_analyzer.rb', line 18

def get_commit_history
  `git log --reverse --pretty=format:"%H"`.split(/\n/).reject{|line| line == ""}
end

#get_logsObject



10
11
12
# File 'lib/churn/scm/git_analyzer.rb', line 10

def get_logs
  `git log #{date_range} --name-only --pretty=format:`.split(/\n/).reject{|line| line == ""}
end

#get_revisionsObject



14
15
16
# File 'lib/churn/scm/git_analyzer.rb', line 14

def get_revisions
  `git log #{date_range} --pretty=format:"%H"`.split(/\n/).reject{|line| line == ""}
end