From c772f87ee0a75d6205b4d5e46954002d60fc3179 Mon Sep 17 00:00:00 2001 From: Adam Byrtek Date: Fri, 14 Aug 2009 15:38:43 +0200 Subject: [PATCH 1/8] Subversion info structure extended to include repository URL. --- lib/source_control/subversion.rb | 4 ++-- lib/source_control/subversion/info_parser.rb | 2 +- .../source_control/subversion/info_parser_test.rb | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/source_control/subversion.rb b/lib/source_control/subversion.rb index 3f86889..e9f4dc8 100644 --- a/lib/source_control/subversion.rb +++ b/lib/source_control/subversion.rb @@ -131,7 +131,7 @@ module SourceControl revision.respond_to?(:number) ? revision.number : revision.to_i end - Info = Struct.new :revision, :last_changed_revision, :last_changed_author + Info = Struct.new :revision, :last_changed_revision, :last_changed_author, :url class ExternalReasons < Struct.new :external, :reasons def <<(reason) @@ -145,4 +145,4 @@ module SourceControl end end -end \ No newline at end of file +end diff --git a/lib/source_control/subversion/info_parser.rb b/lib/source_control/subversion/info_parser.rb index 333fdb8..ae78acc 100644 --- a/lib/source_control/subversion/info_parser.rb +++ b/lib/source_control/subversion/info_parser.rb @@ -4,7 +4,7 @@ module SourceControl class InfoParser def parse(xml) info = XmlSimple.xml_in(xml.to_s, 'ForceArray' => false)['entry'] - Subversion::Info.new(info['revision'].to_i, info['commit']['revision'].to_i, info['commit']['author']) + Subversion::Info.new(info['revision'].to_i, info['commit']['revision'].to_i, info['commit']['author'], info['url']) end end diff --git a/test/unit/source_control/subversion/info_parser_test.rb b/test/unit/source_control/subversion/info_parser_test.rb index 015e173..408ef7b 100644 --- a/test/unit/source_control/subversion/info_parser_test.rb +++ b/test/unit/source_control/subversion/info_parser_test.rb @@ -117,7 +117,8 @@ EOF def test_should_parse_INFO_XML_OUTPUT expected_result = {:revision => 328, :last_changed_revision => 328, - :last_changed_author => 'stellsmi'} + :last_changed_author => 'stellsmi', + :url => 'svn://rubyforge.org/var/svn/cruisecontrolrb'} assert_info_equal expected_result, parse_info(INFO_XML_OUTPUT) end @@ -125,7 +126,8 @@ EOF def test_should_parse_INFO_XML_OUTPUT_WITH_WORKING_COPY expected_result = {:revision => 328, :last_changed_revision => 328, - :last_changed_author => 'stellsmi'} + :last_changed_author => 'stellsmi', + :url => 'svn://rubyforge.org/var/svn/cruisecontrolrb/README'} assert_info_equal expected_result, parse_info(INFO_XML_OUTPUT_WITH_WORKING_COPY) end @@ -133,7 +135,8 @@ EOF def test_should_parse_INFO_XML_OUTPUT_WITH_LOCK expected_result = {:revision => 328, :last_changed_revision => 328, - :last_changed_author => 'stellsmi'} + :last_changed_author => 'stellsmi', + :url => 'svn://rubyforge.org/var/svn/cruisecontrolrb'} assert_info_equal expected_result, parse_info(INFO_XML_OUTPUT_WITH_LOCK) end @@ -141,7 +144,8 @@ EOF def test_should_parse_INFO_XML_OUTPUT_WITH_CONFLICT expected_result = {:revision => 328, :last_changed_revision => 328, - :last_changed_author => 'stellsmi'} + :last_changed_author => 'stellsmi', + :url => 'svn://rubyforge.org/var/svn/cruisecontrolrb/README'} assert_info_equal expected_result, parse_info(INFO_XML_OUTPUT_WITH_CONFLICT) end -- 1.6.3.3