[Bps-public-commit] Net-Google-Code branch, issues-api, updated. 5d0846c56932c1ff2dbbac2de2011df2ffeca0c6

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Oct 16 22:48:40 EDT 2009


The branch, issues-api has been updated
       via  5d0846c56932c1ff2dbbac2de2011df2ffeca0c6 (commit)
       via  41940d76c0cb87da4cad89a42088bb7dd6404b8b (commit)
       via  820c07010f2d978a51bc1401c1c5f49157ebc2e1 (commit)
       via  5e3a351e8eafea64f97879fe837097faf99c5c49 (commit)
      from  b43b5a544006b4e4d9e09808093ebba5428f6a36 (commit)

Summary of changes:
 lib/Net/Google/Code/Issue.pm         |    2 +-
 lib/Net/Google/Code/Issue/Comment.pm |    5 +++--
 lib/Net/Google/Code/Issue/Util.pm    |   16 ++++++++++++----
 t/02.issue.t                         |    2 ++
 t/03.comment.t                       |    2 +-
 5 files changed, 19 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 5e3a351e8eafea64f97879fe837097faf99c5c49
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 17 10:39:40 2009 +0800

    trim trailing spaces for description/content

diff --git a/lib/Net/Google/Code/Issue.pm b/lib/Net/Google/Code/Issue.pm
index ef72c9b..3c84536 100644
--- a/lib/Net/Google/Code/Issue.pm
+++ b/lib/Net/Google/Code/Issue.pm
@@ -134,7 +134,7 @@ sub parse {
 
     my $text = $description->find_by_tag_name('pre')->as_text;
     $text =~ s/^\s+//;
-    $text =~ s/\s+$/\n/;
+    $text =~ s/\s+$//;
     $text =~ s/\r\n/\n/g;
     $self->description( $text );
 
diff --git a/lib/Net/Google/Code/Issue/Comment.pm b/lib/Net/Google/Code/Issue/Comment.pm
index 5093691..417c81b 100644
--- a/lib/Net/Google/Code/Issue/Comment.pm
+++ b/lib/Net/Google/Code/Issue/Comment.pm
@@ -39,7 +39,7 @@ sub parse {
     $self->date(Net::Google::Code::DateTime->new_from_string( $element->look_down( class => 'date' )->attr('title') ));
     my $content = $element->find_by_tag_name('pre')->as_text;
     $content =~ s/^\s+//;
-    $content =~ s/\s+$/\n/;
+    $content =~ s/\s+$//;
     $content =~ s/\r\n/\n/g;
     $self->content($content);
 

commit 820c07010f2d978a51bc1401c1c5f49157ebc2e1
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 17 10:40:34 2009 +0800

    tweak api's way of handling content

diff --git a/lib/Net/Google/Code/Issue/Util.pm b/lib/Net/Google/Code/Issue/Util.pm
index 19de7c4..751c7e4 100644
--- a/lib/Net/Google/Code/Issue/Util.pm
+++ b/lib/Net/Google/Code/Issue/Util.pm
@@ -52,11 +52,19 @@ sub translate_from_xml {
             }
         }
         elsif ( $k eq 'content' ) {
-            my $tree =
-              Net::Google::Code::Role::HTMLTree->html_tree(
-                html => $ref->{$k}->{'#text'} );
-            my $text = $tree->as_text;
+            my $text;
+            if ( $ref->{$k}{-type} eq 'html' ) {
+                my $tree =
+                  Net::Google::Code::Role::HTMLTree->html_tree(
+                    html => '<pre>' . $ref->{$k}->{'#text'} . '</pre>' );
+                $text = $tree->as_text;
+            }
+            else {
+                $text = $ref->{$k}->{'#text'};
+            }
+
             $text =~ s/\s+$// if $text;
+
             if ( $args{type} eq 'issue' ) {
                 $ref->{description} = $text;
                 delete $ref->{$k};

commit 41940d76c0cb87da4cad89a42088bb7dd6404b8b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 17 10:43:46 2009 +0800

    don't set content if the content is bogus for comment

diff --git a/lib/Net/Google/Code/Issue/Comment.pm b/lib/Net/Google/Code/Issue/Comment.pm
index 417c81b..8d91e00 100644
--- a/lib/Net/Google/Code/Issue/Comment.pm
+++ b/lib/Net/Google/Code/Issue/Comment.pm
@@ -41,7 +41,8 @@ sub parse {
     $content =~ s/^\s+//;
     $content =~ s/\s+$//;
     $content =~ s/\r\n/\n/g;
-    $self->content($content);
+    $self->content($content)
+      unless $content eq '(No comment was entered for this change.)';
 
     my $updates = $element->look_down( class => 'updates' );
     if ($updates) {

commit 5d0846c56932c1ff2dbbac2de2011df2ffeca0c6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 17 10:46:17 2009 +0800

    update tests for the description/content trailing spaces change

diff --git a/t/02.issue.t b/t/02.issue.t
index f3804e8..9733d25 100644
--- a/t/02.issue.t
+++ b/t/02.issue.t
@@ -42,6 +42,8 @@ What happens instead?
 Installer simply fails, notifying the user to adjust their firewall settings.
 EOF
 
+$description =~ s/\s+$//;
+
 my %info = (
     id          => 14,
     summary     => 'Proxy settings for installer',
diff --git a/t/03.comment.t b/t/03.comment.t
index 9d2c899..b28adc2 100644
--- a/t/03.comment.t
+++ b/t/03.comment.t
@@ -32,7 +32,7 @@ my %info = (
     sequence => 18,
     author   => 'jsykari',
     date     => '2008-09-03T11:44:39',
-    content  => "haha\n",
+    content  => "haha",
 );
 
 for my $item ( keys %info ) {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list