class Churn::SvnAnalyzer

Analyzes SVN SCM to find recently changed files, and what lines have been altered

Public Class Methods

supported?() click to toggle source

@return [Boolean]

# File lib/churn/scm/svn_analyzer.rb, line 7
def self.supported?
  File.exist?(".svn")
end

Public Instance Methods

generate_history(starting_point) click to toggle source

@raise RunTimeError Currently, the generate history option does not support Subversion

# File lib/churn/scm/svn_analyzer.rb, line 17
def generate_history(starting_point)
  raise NotImplementedError, "currently the generate history option does not support subversion"
end
get_logs() click to toggle source

@return [Array]

# File lib/churn/scm/svn_analyzer.rb, line 12
def get_logs
  `svn log --verbose#{date_range}#{svn_credentials}`.split(/\n/).map { |line| clean_up_svn_line(line) }.compact
end
get_revisions() click to toggle source

This method is not supported by SVN @return [Array]

# File lib/churn/scm/svn_analyzer.rb, line 23
def get_revisions
  []
end
get_updated_files_change_info(revision, revisions) click to toggle source

This method is not supported by SVN @return [Hash]

# File lib/churn/scm/svn_analyzer.rb, line 29
def get_updated_files_change_info(revision, revisions)
  {}
end

Private Instance Methods

clean_up_svn_line(line) click to toggle source
# File lib/churn/scm/svn_analyzer.rb, line 46
def clean_up_svn_line(line)
  match = line.match(/\W*[A,M]\W+(\/.*)\b/)
  match ? match[1] : nil
end
date_range() click to toggle source
# File lib/churn/scm/svn_analyzer.rb, line 39
def date_range
  if @start_date
    date = Chronic.parse(@start_date)
    " --revision {#{date.strftime('%Y-%m-%d')}}:{#{Time.now.strftime('%Y-%m-%d')}}"
  end
end
svn_credentials() click to toggle source
# File lib/churn/scm/svn_analyzer.rb, line 35
def svn_credentials
  " --username #{ENV['SVN_USR']} --password #{ENV['SVN_PWD']}" if ENV['SVN_PWD'] && ENV['SVN_USR']
end