]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
Refactor thread-to-mbox.pl
authorIan Campbell <ijc@hellion.org.uk>
Mon, 29 Oct 2012 13:40:11 +0000 (14:40 +0100)
committerIan Campbell <ijc@hellion.org.uk>
Mon, 29 Oct 2012 13:40:11 +0000 (14:40 +0100)
Bugs/Message.pm
thread-to-mbox.pl

index 1b7d6b3e4749d4e9998b9b05facfd9e1f98a2999..88315996ff56d36841dfc5e24a2b6ec4c9387671 100644 (file)
@@ -189,12 +189,7 @@ sub subthread {
     my %refs;
     $refs{$self->{id}} = 1;
     $self->_subthread(\%refs);
-    for my $r ( keys %refs ) {
-       my $m = Bugs::Message->lookup_id($self->{dbh}, $r);
-       #print "Ref ".$m->{msgid}."\n";
-       open F, "xen-devel.ml/" . $m->{msgid} or die "OPEN";
-       print for ( <F> ) ;
-    }
+    return keys %refs;
 }
 
 1;
index d2e36d1a415c3c93419f2f1262bdad69fe11b539..324defd42a3e8a8da311ae8a51e0c881c41d8ad9 100755 (executable)
@@ -7,12 +7,24 @@ use Bugs::Common qw(readconfig opendb);
 use Bugs::Message;
 
 readconfig();
-our $db = opendb();
+our $dbh = opendb();
 
 our $msgid = $ARGV[0];
 
-our $msg = Bugs::Message->lookup_msgid($db, $msgid);
+our $msg = Bugs::Message->lookup_msgid($dbh, $msgid);
 our $id = $msg->id;
 
 print STDERR "Message is $id\n";
-$msg->subthread;
+our @msgs = $msg->subthread;
+
+for my $r ( @msgs  ) {
+    my $m = Bugs::Message->lookup_id($dbh, $r);
+    #print "Ref ".$m->{msgid}."\n";
+    #open F, "xen-devel.ml/" . $m->{msgid} or die "OPEN";
+    my $fh;
+    $fh = $m->headers;
+    print for ( <$fh> ) ;
+    print "\n";
+    $fh = $m->body;
+    print for ( <$fh> ) ;
+}