[Bps-public-commit] SD branch, master, updated. 57aca1c12806ad1ce8e1b1a6d65ed8cb6a6c7769

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Jun 2 02:08:07 EDT 2009


The branch, master has been updated
       via  57aca1c12806ad1ce8e1b1a6d65ed8cb6a6c7769 (commit)
       via  bb03d45483d78be88a6a3355b8fa19ab87e0fbea (commit)
      from  21e9cc18777b167ed489a3d0511442ba0b27d452 (commit)

Summary of changes:
 lib/App/SD/Replica/trac.pm             |    6 ++++--
 lib/App/SD/Replica/trac/PushEncoder.pm |   21 ++++++++++++++-------
 t/sd-trac/basic.t                      |    2 +-
 3 files changed, 19 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit bb03d45483d78be88a6a3355b8fa19ab87e0fbea
Author: sunnavy <sunnavy at gmail.com>
Date:   Tue Jun 2 14:07:24 2009 +0800

    added closed status for trac. also, if the status is not "closed" or active, set corresponding resolution when pushing

diff --git a/lib/App/SD/Replica/trac.pm b/lib/App/SD/Replica/trac.pm
index ad9031c..98c6f11 100644
--- a/lib/App/SD/Replica/trac.pm
+++ b/lib/App/SD/Replica/trac.pm
@@ -101,9 +101,11 @@ sub database_settings {
         @resolutions = qw/fixed invalid wontfix duplicate
           worksforme/;
     }
+
+    my @active_statuses = qw/new accepted assigned reopened/;
     return {
-        active_statuses => [qw/new accepted assigned reopened/],
-        statuses => [ qw/new accepted assigned reopened/, @resolutions, ],
+        active_statuses => [@active_statuses],
+        statuses => [ @active_statuses, 'closed', @resolutions ],
     };
 }
 
diff --git a/lib/App/SD/Replica/trac/PushEncoder.pm b/lib/App/SD/Replica/trac/PushEncoder.pm
index a3f2727..c73511c 100644
--- a/lib/App/SD/Replica/trac/PushEncoder.pm
+++ b/lib/App/SD/Replica/trac/PushEncoder.pm
@@ -95,14 +95,21 @@ sub _recode_props_for_integrate {
     my %attr;
 
     for my $key ( keys %props ) {
-        next unless ( $key =~ /^(summary|queue|status|owner|custom)/ );
-        if ( $key =~ /^custom-(.*)/ ) {
-            $attr{cf}->{$1} = $props{$key};
-        } else {
-            $attr{$key} = $props{$key};
-        }
+        next unless ( $key =~ /^(summary|status|owner)/ );
         if ( $key eq 'status' ) {
-            $attr{$key} =~ s/^closed$/resolved/;
+            my $active_statuses =
+                $self->sync_source->database_settings->{active_statuses};
+            if ( grep { $props{$key} eq $_ } @$active_statuses, 'closed' ) {
+                $attr{$key} = $props{$key};
+            }
+            else {
+                $attr{$key} = 'closed';
+                $attr{resolution} = $props{$key};
+            }
+
+        }
+        else {
+            $attr{$key} = $props{$key};
         }
     }
     return \%attr;

commit 57aca1c12806ad1ce8e1b1a6d65ed8cb6a6c7769
Author: sunnavy <sunnavy at gmail.com>
Date:   Tue Jun 2 14:07:48 2009 +0800

    no resolved status for trac

diff --git a/t/sd-trac/basic.t b/t/sd-trac/basic.t
index 23ea721..f1c5d42 100644
--- a/t/sd-trac/basic.t
+++ b/t/sd-trac/basic.t
@@ -127,7 +127,7 @@ diag($err);
 is(count_tickets_in_trac(),1);
 my $closed_ticket = Net::Trac::Ticket->new( connection => $trac );
 ok( $closed_ticket->load(1) );
-is( $closed_ticket->status, 'resolved', "The ticket is closed after we push to trac" );
+is( $closed_ticket->status, 'closed', "The ticket is closed after we push to trac" );
 
 # 
 # Push to trac a second time -- this should cause no updates

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



More information about the Bps-public-commit mailing list