[Rt-commit] rtir branch, 2.9-trunk, updated. b34d0c194d4dc0caeb813626cf1215006c8d9a08

Ruslan Zakirov ruz at bestpractical.com
Thu Jul 7 20:37:25 EDT 2011


The branch, 2.9-trunk has been updated
       via  b34d0c194d4dc0caeb813626cf1215006c8d9a08 (commit)
       via  05669870bd8afb7c22dfdb3434488cad5bdd5c1a (commit)
       via  947a1c6f078063b845ff761fc9e462d62296ecd3 (commit)
       via  ca2cb2f382014e898c6824c8438afa23830b8cef (commit)
       via  de3b2e37e26f44ec575477433e4667fc19f10c3a (commit)
       via  1538887a411f9d4ad1d5894496629b9c4998b30e (commit)
       via  3efce6ce864b352888cf79d98eccd013a1790002 (commit)
       via  387dafe02c32fbe3f1f95b3247ca6d2a0ca6d74c (commit)
       via  7f3f22ac86f251cc6492da9622bf4c8039688c10 (commit)
       via  ab07dc4ee6444ea9a5e10e245410bb47e534daa2 (commit)
       via  054ca2ec3eaa350189dba8402506be86069c8e4a (commit)
       via  867b7670d4bdbd6eca323d92e53fc77680cd52e4 (commit)
       via  3a5d3087f988b375ba1e562d2e31bd587e78f33a (commit)
      from  399c3e5ac1e7e176262d10029159d5cc716c4f3b (commit)

Summary of changes:
 .gitignore                        |    7 ++-
 META.yml                          |    2 +-
 Makefile.PL                       |    4 +-
 README                            |   14 ++----
 TODO.porting_over_RT4             |   26 +++++++--
 etc/upgrade/2.9.0/content         |  105 +++++++++++++++++++++++++++++++++---
 inc/Module/Install.pm             |    4 +-
 inc/Module/Install/AutoInstall.pm |    2 +-
 inc/Module/Install/Base.pm        |    2 +-
 inc/Module/Install/Can.pm         |    2 +-
 inc/Module/Install/Fetch.pm       |    2 +-
 inc/Module/Install/Include.pm     |    2 +-
 inc/Module/Install/Makefile.pm    |    2 +-
 inc/Module/Install/Metadata.pm    |    9 ++--
 inc/Module/Install/RTx.pm         |   44 ++++++++++++++-
 inc/Module/Install/Win32.pm       |    2 +-
 inc/Module/Install/WriteAll.pm    |    2 +-
 17 files changed, 183 insertions(+), 48 deletions(-)

- Log -----------------------------------------------------------------
commit 3a5d3087f988b375ba1e562d2e31bd587e78f33a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 7 21:53:31 2011 +0400

    update gitignore, ignore t/tmp/

diff --git a/.gitignore b/.gitignore
index 19902d6..1cd01f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
+*.swp
+*.bak
+*.old
 Makefile
-Makefile.old
-MANIFEST.bak
 blib/
 pm_to_blib
-*.swp
+t/tmp/

commit 867b7670d4bdbd6eca323d92e53fc77680cd52e4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 7 21:54:06 2011 +0400

    we need RT 4 for newer RTIR

diff --git a/Makefile.PL b/Makefile.PL
index 762281e..9e29e86 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -7,8 +7,8 @@ version_from('lib/RT/IR.pm');
 
 { # check RT version
     my @v = split /\./, "$RT::VERSION";
-    unless ($v[0]>=3 && $v[1]>=9 && ($v[2]>=4 || $v[2]eq'HEAD')) {
-        die "RTIR 2.4.2 and newer needs RT 3.9.4 at least, you have $RT::VERSION";
+    unless ($v[0]>=4) {
+        die "RTIR 2.9.x and newer needs RT 4.0 at least, you have $RT::VERSION";
     }
 }
 

commit 054ca2ec3eaa350189dba8402506be86069c8e4a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 7 21:55:58 2011 +0400

    update M::I

diff --git a/META.yml b/META.yml
index abed910..9f38c92 100644
--- a/META.yml
+++ b/META.yml
@@ -10,7 +10,7 @@ build_requires:
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
-generated_by: 'Module::Install version 1.00'
+generated_by: 'Module::Install version 1.01'
 license: gpl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 8ee839d..74caf9c 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -467,4 +467,4 @@ sub _CLASS ($) {
 
 1;
 
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2011 Adam Kennedy.
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index f1f5356..bc3d172 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b55bda3..d3662c9 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 71ccc27..276409a 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -9,7 +9,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index ec1f106..093cb7a 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index a28cd4c..90cc979 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 5dfd0e9..4c71003 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index cfe45b3..3b01e09 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -515,6 +515,7 @@ sub __extract_license {
 		'GNU Free Documentation license'     => 'unrestricted', 1,
 		'GNU Affero General Public License'  => 'open_source',  1,
 		'(?:Free)?BSD license'               => 'bsd',          1,
+		'Artistic license 2\.0'              => 'artistic_2',   1,
 		'Artistic license'                   => 'artistic',     1,
 		'Apache (?:Software )?license'       => 'apache',       1,
 		'GPL'                                => 'gpl',          1,
@@ -550,9 +551,9 @@ sub license_from {
 
 sub _extract_bugtracker {
 	my @links   = $_[0] =~ m#L<(
-	 \Qhttp://rt.cpan.org/\E[^>]+|
-	 \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
-	 \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+	 https?\Q://rt.cpan.org/\E[^>]+|
+	 https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+	 https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
 	 )>#gx;
 	my %links;
 	@links{@links}=();
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 726b3fb..73b9cda 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,7 +8,7 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.28';
+our $VERSION = '0.29';
 
 use FindBin;
 use File::Glob     ();
@@ -44,7 +44,7 @@ sub RTx {
         local @INC = (
             $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
             @INC,
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" ) 
+            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
                 } grep $_, @prefixes
         );
         until ( eval { require RT; $RT::LocalPath } ) {
@@ -186,8 +186,46 @@ sub RTxInit {
     die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
 }
 
+# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
+{ my %word = (
+    a     => -4,
+    alpha => -4,
+    b     => -3,
+    beta  => -3,
+    pre   => -2,
+    rc    => -1,
+    head  => 9999,
+);
+sub cmp_version($$) {
+    my ($a, $b) = (@_);
+    my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
+        split /([^0-9]+)/, $a;
+    my @b = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
+        split /([^0-9]+)/, $b;
+    @a > @b
+        ? push @b, (0) x (@a- at b)
+        : push @a, (0) x (@b- at a);
+    for ( my $i = 0; $i < @a; $i++ ) {
+        return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i];
+    }
+    return 0;
+}}
+sub requires_rt {
+    my ($self,$version) = @_;
+
+    # if we're exactly the same version as what we want, silently return
+    return if ($version eq $RT::VERSION);
+
+    my @sorted = sort cmp_version $version,$RT::VERSION;
+
+    if ($sorted[-1] eq $version) {
+        # should we die?
+        warn "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+    }
+}
+
 1;
 
 __END__
 
-#line 304
+#line 348
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index edc18b4..3139a63 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index d0f6599..1f724a7 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

commit ab07dc4ee6444ea9a5e10e245410bb47e534daa2
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 00:58:59 2011 +0400

    check that RT::IR is in @Plugins, it's important
    
    if it's not there then default config is not loaded and
    lifecycles RTIR uses are not defined

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 8cd7041..13c5134 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -1,5 +1,12 @@
-
 @Initial = (
+    sub {
+        return 1 if grep $_ eq 'RT::IR', RT->Config->Get('Plugins');
+
+        die "Please enable RT::IR plugin in the config file.\n";
+    },
+);
+
+ at Final = (
 
     # IP type change
     sub {

commit 7f3f22ac86f251cc6492da9622bf4c8039688c10
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 01:02:13 2011 +0400

    set lifecycles on RTIR's queues during upgrade

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 13c5134..85d6dcd 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -110,4 +110,31 @@
             $action->Delete();
         }
     },
+
+    sub {
+        for my $name ( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
+            my $queue = RT::Queue->new($RT::SystemUser);
+            $queue->Load( $name );
+            unless ( $queue->id ) {
+                $RT::Logger->error("Couldn't load queue '$name'");
+                next;
+            }
+
+            my $new_cycle = lc $name;
+            $new_cycle =~ s/ /_/;
+
+            if ( $queue->Lifecycle->Name eq $new_cycle ) {
+                $RT::Logger->debug("Queue $name already uses '$new_cycle' lifecycle");
+                next;
+            }
+
+            my ($status, $msg) = $queue->SetLifecycle( $new_cycle );
+            unless ( $status ) {
+                $RT::Logger->error("Couldn't change lifecycle: $msg");
+                next;
+            }
+
+            $RT::Logger->debug("Changed lifecycle of queue '$name' to '$new_lifecycle'");
+        }
+    },
 );

commit 387dafe02c32fbe3f1f95b3247ca6d2a0ca6d74c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 01:22:08 2011 +0400

    delete RT::FM from the README file

diff --git a/README b/README
index e1efc7e..daa2f3c 100644
--- a/README
+++ b/README
@@ -14,8 +14,7 @@ or RTIR, please contact Best Practical at sales at bestpractical.com.
 REQUIRED PACKAGES:
 ------------------
 
-o   RT 3.9.6 or later, configured, installed and tested.
-o   RTFM 2.4.1 or later, configured, installed and tested.
+o RT 4.0.0 or later, configured, installed and tested.
 
 
 Upgrade instructions:
@@ -29,11 +28,7 @@ information.
 Installation instructions:
 --------------------------
 
-1) Install RT 3.9.6 or newer following RT's regular installation instructions
-
-2) Install RTFM 2.4.1 or nerwer, following the installation instructions
-   in RTFM's README file. (Don't forget to run "make initdb" to set up the 
-   database for RTFM and activate it using @Plugins option in the RT config); 
+1) Install RT 4.0.0 or newer following RT's regular installation instructions
 
 3) Run "perl Makefile.PL" to generate a makefile for RTIR. 
 
@@ -50,7 +45,7 @@ Installation instructions:
 
 7) Activate RTIR extension in the RT config:
 
-    Set(@Plugins, 'RT::FM', 'RT::IR');
+    Set(@Plugins, 'RT::IR');
 
 8) Stop and start your web server.
 
@@ -87,8 +82,7 @@ Configuring RTIR
    RT -> Configuration -> Groups -> DutyTeam -> Members.
 
 5) You can override values in the RTIR_Config.pm in your
-   RT_SiteConfig.pm file. Just add your customizations after the "require" 
-   line mentioned above.
+   RT_SiteConfig.pm file. Just add your customizations.
 
 
 SETTING UP THE MAIL GATEWAY 

commit 3efce6ce864b352888cf79d98eccd013a1790002
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 03:07:38 2011 +0400

    first set lifecycles, then change statuses

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 85d6dcd..ec34a0b 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -19,7 +19,34 @@
         }
     },
 
-    #
+    # set lifecycles on queues
+    sub {
+        for my $name ( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
+            my $queue = RT::Queue->new($RT::SystemUser);
+            $queue->Load( $name );
+            unless ( $queue->id ) {
+                $RT::Logger->error("Couldn't load queue '$name'");
+                next;
+            }
+
+            my $new_cycle = lc $name;
+            $new_cycle =~ s/ /_/;
+
+            if ( $queue->Lifecycle->Name eq $new_cycle ) {
+                $RT::Logger->debug("Queue $name already uses '$new_cycle' lifecycle");
+                next;
+            }
+
+            my ($status, $msg) = $queue->SetLifecycle( $new_cycle );
+            unless ( $status ) {
+                $RT::Logger->error("Couldn't change lifecycle: $msg");
+                next;
+            }
+
+            $RT::Logger->debug("Changed lifecycle of queue '$name' to '$new_lifecycle'");
+        }
+    },
+
     # CF.State => Status
     sub {
         my %state;
@@ -111,30 +138,4 @@
         }
     },
 
-    sub {
-        for my $name ( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
-            my $queue = RT::Queue->new($RT::SystemUser);
-            $queue->Load( $name );
-            unless ( $queue->id ) {
-                $RT::Logger->error("Couldn't load queue '$name'");
-                next;
-            }
-
-            my $new_cycle = lc $name;
-            $new_cycle =~ s/ /_/;
-
-            if ( $queue->Lifecycle->Name eq $new_cycle ) {
-                $RT::Logger->debug("Queue $name already uses '$new_cycle' lifecycle");
-                next;
-            }
-
-            my ($status, $msg) = $queue->SetLifecycle( $new_cycle );
-            unless ( $status ) {
-                $RT::Logger->error("Couldn't change lifecycle: $msg");
-                next;
-            }
-
-            $RT::Logger->debug("Changed lifecycle of queue '$name' to '$new_lifecycle'");
-        }
-    },
 );

commit 1538887a411f9d4ad1d5894496629b9c4998b30e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 03:14:36 2011 +0400

    introduce OUR_QUEUES in the upgrade script
    
    just stop repeating ourself

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index ec34a0b..c62f414 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -1,3 +1,5 @@
+my @OUR_QUEUES = ('Incidents', 'Incident Reports', 'Investigations', 'Blocks');
+
 @Initial = (
     sub {
         return 1 if grep $_ eq 'RT::IR', RT->Config->Get('Plugins');
@@ -21,7 +23,7 @@
 
     # set lifecycles on queues
     sub {
-        for my $name ( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
+        for my $name ( @OUR_QUEUES ) {
             my $queue = RT::Queue->new($RT::SystemUser);
             $queue->Load( $name );
             unless ( $queue->id ) {
@@ -50,9 +52,7 @@
     # CF.State => Status
     sub {
         my %state;
-        for my $queue ( 'Incidents', 'Incident Reports', 'Investigations',
-            'Blocks' )
-        {
+        for my $queue ( @OUR_QUEUES ) {
             my $state = RT::CustomField->new($RT::SystemUser);
             $state->LoadByName( Name => 'State', Queue => $queue );
             $state{$queue} = $state if $state->id;
@@ -61,9 +61,9 @@
         my $Tickets = RT::Tickets->new($RT::SystemUser);
         $Tickets->UnLimit;
         while ( my $ticket = $Tickets->Next ) {
-            next
-              unless $ticket->QueueObj->Name =~
-                  /^(Incidents|Incident Reports|Investigations|Blocks)$/;
+            my $qname = $ticket->QueueObj->Name;
+            next unless grep lc $qname eq lc $_, @OUR_QUEUES;
+
             my $txns = $ticket->Transactions;
             my %done; # in case redo search bite
             while ( my $txn = $txns->Next ) {

commit de3b2e37e26f44ec575477433e4667fc19f10c3a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 03:33:02 2011 +0400

    update todo, we now set lifecycles during upgrade

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 132e2ac..31ae4db 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -14,8 +14,6 @@
 
 === UPGRADING
 
-* upgrade script that setups lifecycle column on the queues
-
 * upgrade script that unapplies State custom field
 
 * upgrade script that deletes all Status changes from 

commit ca2cb2f382014e898c6824c8438afa23830b8cef
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 03:34:15 2011 +0400

    put status of tests into todo file

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 31ae4db..9e213ce 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -65,3 +65,19 @@
   small differences
 
 * move html/RTIR/Incident/LinkArticles.html -> html/RTIR/Link/Articles.html
+
+
+=== TESTS
+
+Test Summary Report
+-------------------
+t/016-date-started.t                          (Wstat: 256 Tests: 68 Failed: 1)
+  Failed test:  40
+  Non-zero exit status: 1
+t/incident/bulk-abandon.t                     (Wstat: 65280 Tests: 87 Failed: 0)
+  Non-zero exit status: 255
+  Parse errors: Bad plan.  You planned 105 tests but ran 87.
+Files=36, Tests=2441, 1209 wallclock secs ( 0.78 usr  0.23 sys + 406.37 cusr 28.73 csys = 436.11 CPU)
+Result: FAIL
+Failed 2/36 test programs. 1/2441 subtests failed.
+

commit 947a1c6f078063b845ff761fc9e462d62296ecd3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 03:38:09 2011 +0400

    split disabling CFs during upgrade, more debug

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index c62f414..a03f0ff 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -104,12 +104,34 @@ my @OUR_QUEUES = ('Incidents', 'Incident Reports', 'Investigations', 'Blocks');
                 }
             }
         }
+    },
+
+    # un-apply and disable State custom fields
+    sub {
+        for my $qname ( @OUR_QUEUES ) {
+            my $queue = RT::Queue->new( $RT::SystemUser );
+            $queue->Load( $qname );
+            unless ( $queue->id ) {
+                $RT::Logger->error("Couldn't load queue '$qname'");
+                next;
+            }
 
-        for my $queue ( keys %state ) {
-            $state{$queue}->SetDisabled(1);
+            my $cf = RT::CustomField->new( $RT::SystemUser );
+            $cf->LoadByName( Name => 'State', Queue => $queue->id );
+            unless ( $cf->id ) {
+                $RT::Logger->error("Couldn't load State custom field applied to queue '$qname'");
+                next;
+            }
+
+            unless ( $cf->Disabled ) {
+                my ($status, $msg) = $cf->SetDisabled(1);
+                $RT::Logger->error("Couldn't disable custom field #". $cf->id .": $msg")
+                    unless $status;
+            }
         }
     },
 
+
     # remove state scrips: 2 actions and 2 scrips
     sub {
         for my $name (qw/Incident Investigation/) {

commit 05669870bd8afb7c22dfdb3434488cad5bdd5c1a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 03:41:14 2011 +0400

    unapply State custom fields from queues

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 9e213ce..fb58e2b 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -14,8 +14,6 @@
 
 === UPGRADING
 
-* upgrade script that unapplies State custom field
-
 * upgrade script that deletes all Status changes from 
   transactions for RTIR's queues and turns changes of
   the State CFs into Status changes
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index a03f0ff..6e53774 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -123,6 +123,12 @@ my @OUR_QUEUES = ('Incidents', 'Incident Reports', 'Investigations', 'Blocks');
                 next;
             }
 
+            {
+                my ($status, $msg) = $cf->RemoveFromObject( $queue );
+                $RT::Logger->error("Couldn't unapply custom field #". $cf->id .": $msg")
+                    unless $status;
+            }
+
             unless ( $cf->Disabled ) {
                 my ($status, $msg) = $cf->SetDisabled(1);
                 $RT::Logger->error("Couldn't disable custom field #". $cf->id .": $msg")

commit b34d0c194d4dc0caeb813626cf1215006c8d9a08
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jul 8 04:36:36 2011 +0400

    delete Status transactions during upgrade

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index fb58e2b..0f83343 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -14,9 +14,11 @@
 
 === UPGRADING
 
-* upgrade script that deletes all Status changes from 
-  transactions for RTIR's queues and turns changes of
-  the State CFs into Status changes
+* make sure we release DBIx::SB with cud-from-select branch
+  merged and depend on it
+
+* upgrade script that turns changes of the State CFs into
+  Status changes
 
 === BRINGING UP TO DATE
 
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 6e53774..7dbdd7c 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -49,6 +49,30 @@ my @OUR_QUEUES = ('Incidents', 'Incident Reports', 'Investigations', 'Blocks');
         }
     },
 
+    # delete tickets' Status changes (txns) in RTIR queues, in RTIR queues
+    # for variouse reasons we kept Status and State in sync with each other
+    # and were hiding these txns in the UI. Now we delete old status changes
+    # and convert State changes into Status changes
+    sub {
+        for my $qname ( @OUR_QUEUES ) {
+            my $queue = RT::Queue->new( $RT::SystemUser );
+            $queue->Load( $qname );
+            unless ( $queue->id ) {
+                $RT::Logger->error("Couldn't load queue '$qname'");
+                next;
+            }
+
+            my $query = "SELECT txn.id FROM Transactions txn JOIN Tickets t"
+                ." WHERE txn.ObjectType = 'RT::Ticket' AND txn.ObjectId = t.id"
+                ." AND t.Type = 'ticket' AND t.Queue = ?"
+                ." AND ((txn.Type = 'Set' AND txn.Field = 'Status') OR txn.Type = 'Status')"
+            ;
+            my $res = $RT::Handle->DeleteFromSelect( 'Transactions', $query, $queue->id );
+            $RT::Logger->error("Couldn't delete transactions: $res")
+                unless $res;
+        }
+    },
+
     # CF.State => Status
     sub {
         my %state;

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


More information about the Rt-commit mailing list