[rt-users] Is it possible to un-merge tickets?

Tom Barron tbarron at ornl.gov
Mon Mar 31 10:48:07 EST 2003


On Fri, Mar 28, 2003 at 08:50:01PM +0800, Autrijus Tang wrote:
> On Thu, Mar 27, 2003 at 01:16:52PM -0500, Tom Barron wrote:
> > After looking through the docs (and searching for the string 'merge'
> > -- I got one hit, which did not address this issue), I suspect not.
> > Does anyone know of a way? Thanks...
> 
> Hand-tweaking the EffectiveId field in the Tickets table?

Thank you! This appears to do exactly what I want. Here's the perl
subroutine we're using, in case the code is helpful to anyone else:

sub rt_unmerge
{
   my ($arg, $symbol, $help, $fname);
   ($arg) = @_;
   ($arg eq "help") && return("unmerge a ticket");

   $exec = 1;

   GetOptions("-exec!" => \$exec,
              "-ticket=s" => \$ticket_id);

   fatal("usage: rttool unmerge -ticket <ticket-id>")   
      if (!defined($ticket_id));

   $mysql = `which mysql`;
   fatal("mysql is not available on this machine") 
      if ($mysql =~ /no mysql in/);

   $cmd = "mysql -u $username $dbname -p -e \"update Tickets"
      . " set EffectiveId = id where id = $ticket_id\"";

   if ($exec)
   {
      print("$cmd\n");
      system($cmd);
   }
   else
   {
      print("would do '$cmd'\n");
   }
}

-- 
Tom Barron                                           tbarron at ornl.gov
Computer Science & Mathematics                 (865) 576-1620 (voice)
Oak Ridge National Laboratory                  (865) 241-2850   (fax)



More information about the rt-users mailing list