[Bps-public-commit] r17507 - in Net-Google-Code/trunk: lib/Net/Google/Code
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Jan 1 00:59:58 EST 2009
Author: sunnavy
Date: Thu Jan 1 00:59:58 2009
New Revision: 17507
Modified:
Net-Google-Code/trunk/ (props changed)
Net-Google-Code/trunk/lib/Net/Google/Code/TicketComment.pm
Log:
r18457 at sunnavys-mb: sunnavy | 2009-01-01 13:58:56 +0800
updated comment parse: labels part has old value
Modified: Net-Google-Code/trunk/lib/Net/Google/Code/TicketComment.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/TicketComment.pm (original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/TicketComment.pm Thu Jan 1 00:59:58 2009
@@ -89,14 +89,33 @@
$value =~ s/\s+$//;
if ( $key eq 'Labels' ) {
- if ( $value =~ /([^-]+?)-(.+)/ ) {
- $self->updates->{labels}{$1} = $2;
- }
- elsif ( $value =~ /([^-]+)$/ ) {
- $self->updates->{labels}{$1} = undef;
- }
- else {
- warn "can't parse label from $value";
+# $value here is like "-Pri-2 -Area-Unknown Pri-3 Area-BrowserUI"
+ my @items = split /\s+/, $value;
+
+ for my $value (@items) {
+ if ( $value =~ /^-(.+)/ ) {
+ $value = $1;
+ if ( $value =~ /([^-]+?)-(.+)/ ) {
+ $self->updates->{labels}{$1}{old_value} = $2;
+ }
+ elsif ( $value =~ /([^-]+)$/ ) {
+ $self->updates->{labels}{$1}{old_value} = undef;
+ }
+ else {
+ warn "can't parse label from $value";
+ }
+ }
+ else {
+ if ( $value =~ /([^-]+?)-(.+)/ ) {
+ $self->updates->{labels}{$1}{new_value} = $2;
+ }
+ elsif ( $value =~ /([^-]+)$/ ) {
+ $self->updates->{labels}{$1}{new_value} = undef;
+ }
+ else {
+ warn "can't parse label from $value";
+ }
+ }
}
}
else {
More information about the Bps-public-commit
mailing list