Class: HgCommitLogParser

Inherits:
Object
  • Object
show all
Defined in:
lib/tddium/scm/hg_log_parser.rb

Overview

this is not namespaced under Tddium because we want to eventually move this out into another gem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commit_log) ⇒ HgCommitLogParser

beb3d918995bbe6370bb21fd76b4f433bfd64dc4 commit summary user [email protected] 1399437808.00 user [email protected] 1399437808.00



19
20
21
# File 'lib/tddium/scm/hg_log_parser.rb', line 19

def initialize(commit_log)
  @commit_log = commit_log
end

Instance Attribute Details

#commit_logObject

Returns the value of attribute commit_log.



5
6
7
# File 'lib/tddium/scm/hg_log_parser.rb', line 5

def commit_log
  @commit_log
end

Instance Method Details

#commitsObject

Returns a list of commits in the following format [

"id" =>        "15e8cbd88d68d210953d51c28e26c6b9944a313b",
"author" =>    {"name"=>"Bob Smith", "email"=>"[email protected]",
"committer" => Smith", "email"=>"[email protected]",
"summary"   => "ignore .ruby-version for rvm",
"date"      => 1380603292

}]



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tddium/scm/hg_log_parser.rb', line 32

def commits
  record = []
  commits = []
  commit_log.lines.each do |line|
    line.strip!
    line.sanitize!
    if line.empty?
      c = parse_commit(record)
      commits.push(c)
      record = []
    else
      record.push(line)
    end
  end

  commits
end