43c16127cde8e6c88986723afca8b2f2d4b1d920

Author: Robin Luckey

Date: 2009-10-27 13:33:54 -0700

[FIX] Use Bzr Author name when available

diff --git a/lib/scm/parsers/bzr_parser.rb b/lib/scm/parsers/bzr_parser.rb index 739bbc6..4e924e1 100644 --- a/lib/scm/parsers/bzr_parser.rb +++ b/lib/scm/parsers/bzr_parser.rb @@ -40,6 +40,10 @@ module Scm::Parsers e.token = $1 show_id = true next_state = :data + when /^#{indent}author:\s+(.+?)(\s+<(.+)>)?$/ + e.author_name = $1 + e.author_email = $3 + next_state = :data when /^#{indent}committer:\s+(.+?)(\s+<(.+)>)?$/ e.committer_name = $1 e.committer_email = $3 diff --git a/test/unit/bzr_parser_test.rb b/test/unit/bzr_parser_test.rb index 19bef08..5ed2716 100644 --- a/test/unit/bzr_parser_test.rb +++ b/test/unit/bzr_parser_test.rb @@ -458,5 +458,26 @@ modified: assert_equal "A", commits.first.diffs.last.action assert_equal "newname", commits.first.diffs.last.path end + + def test_different_author_and_committer + log = <<-SAMPLE +------------------------------------------------------------ +revno: 200 +author: Jason Allen <jason@ohloh.net> +committer: Robin Luckey <robin@ohloh.net> +branch nick: foo +timestamp: Wed 2009-06-24 19:47:37 +0200 +message: + Just a message + SAMPLE + + commits = BzrParser.parse(log) + + assert_equal 1, commits.size + assert_equal "Jason Allen", commits.first.author_name + assert_equal "jason@ohloh.net", commits.first.author_email + assert_equal "Robin Luckey", commits.first.committer_name + assert_equal "robin@ohloh.net", commits.first.committer_email + end end end