Class: Churn::HgAnalyzer

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

Overview

Analyzes Hg / Mercurial 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?Array

Returns:

  • (Array)


7
8
9
# File 'lib/churn/scm/hg_analyzer.rb', line 7

def self.supported?
  !!(`hg branch 2>&1` && cmd_success?)
end

Instance Method Details

#generate_history(starting_point) ⇒ Object

Raises:

  • RunTimeError Currently, the generate history option does not support Mercurial



22
23
24
# File 'lib/churn/scm/hg_analyzer.rb', line 22

def generate_history(starting_point)
  raise NotImplementedError, "currently the generate history option does not support mercurial"
end

#get_logsArray

Returns:

  • (Array)


12
13
14
# File 'lib/churn/scm/hg_analyzer.rb', line 12

def get_logs
  `hg log -v#{date_range}`.split("\n").reject{|line| line !~ /^files:/}.map{|line| line.split(" ")[1..-1]}.flatten
end

#get_revisionsArray

Returns:

  • (Array)


17
18
19
# File 'lib/churn/scm/hg_analyzer.rb', line 17

def get_revisions
  `hg log#{date_range}`.split("\n").reject{|line| line !~ /^changeset:/}.map{|line| line[/:(\S+)$/, 1] }
end