Sha256: 01b890164f9d430480dbf71f4c24c0dc39b473bf4a8f7d5fd00804695083f412

Contents?: true

Size: 880 Bytes

Versions: 22

Compression:

Stored size: 880 Bytes

Contents

module Churn

  #analizes Hg / Mercurial SCM to find recently changed files, and what lines have been altered
  class HgAnalyzer < SourceControl
    def get_logs
      `hg log -v#{date_range}`.split("\n").reject{|line| line !~ /^files:/}.map{|line| line.split(" ")[1..-1]}.flatten
    end

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

    private

    def get_diff(revision, previous_revision)
      `hg diff -r #{revision}:#{previous_revision} -U 0`.split(/\n/).select{|line| line.match(/^@@/) || line.match(/^---/) || line.match(/^\+\+\+/) }
    end

    def date_range
      if @start_date
        date = Chronic.parse(@start_date)
        " -d \"> #{date.strftime('%Y-%m-%d')}\""
      end
    end

    def get_recent_file(line)
      super(line).split("\t")[0]
    end

  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
churn-0.0.34 lib/churn/hg_analyzer.rb
churn-0.0.33 lib/churn/hg_analyzer.rb
churn-0.0.32 lib/churn/hg_analyzer.rb
churn-0.0.31 lib/churn/hg_analyzer.rb
churn-0.0.30 lib/churn/hg_analyzer.rb
churn-0.0.29 lib/churn/hg_analyzer.rb
churn-0.0.28 lib/churn/hg_analyzer.rb
churn-0.0.27 lib/churn/hg_analyzer.rb
churn-0.0.26 lib/churn/hg_analyzer.rb
churn-0.0.25 lib/churn/hg_analyzer.rb
churn-0.0.24 lib/churn/hg_analyzer.rb
churn-0.0.23 lib/churn/hg_analyzer.rb
churn-0.0.22 lib/churn/hg_analyzer.rb
churn-0.0.21 lib/churn/hg_analyzer.rb
churn-0.0.20 lib/churn/hg_analyzer.rb
churn-0.0.19 lib/churn/hg_analyzer.rb
rferraz-churn-0.0.19 lib/churn/hg_analyzer.rb
rferraz-churn-0.0.17 lib/churn/hg_analyzer.rb
rferraz-churn-0.0.16 lib/churn/hg_analyzer.rb
churn-0.0.15 lib/churn/hg_analyzer.rb