[Collab-qa-commits] r1249 - udd/udd

lucas at alioth.debian.org lucas at alioth.debian.org
Mon Sep 8 18:58:07 UTC 2008


Author: lucas
Date: 2008-09-08 18:58:06 +0000 (Mon, 08 Sep 2008)
New Revision: 1249

Modified:
   udd/udd/bugs_gatherer.pl
Log:
bugs import cleanup

Modified: udd/udd/bugs_gatherer.pl
===================================================================
--- udd/udd/bugs_gatherer.pl	2008-09-08 18:57:33 UTC (rev 1248)
+++ udd/udd/bugs_gatherer.pl	2008-09-08 18:58:06 UTC (rev 1249)
@@ -125,6 +125,8 @@
 
 	our $t;
 	our $timing;
+
+	run_usertags($config, $source, $dbh);
 	print "Inserting usertags: ",(time() - $t),"s\n" if $timing;
 	$t = time();
 
@@ -135,14 +137,22 @@
 	my @modified_bugs;
 
 	if($src_config{archived}) {
-		@modified_bugs = get_bugs(archive => 1);
+		# some bugs (the unarchived ones) are in both list. exclude them.
+		my %unarchived;
+		foreach my $b (get_bugs()) {
+			$unarchived{$b} = 1;
+		}
+		foreach my $b (get_bugs(archive => 1)) {
+			push(@modified_bugs, $b) if not $unarchived{$b};
+		}
 	} else {
 		@modified_bugs = get_bugs();
 	}
 	my @modified_bugs2;
 	if ($src_config{debug}) {
-		foreach $b (@modified_bugs) {
-			push(@modified_bugs2, $b) if ($b =~ /0$/);
+		print "Running in debug mode with restricted bug list!!\n";
+		foreach my $b (@modified_bugs) {
+			push(@modified_bugs2, $b) if ($b =~ /58$/);
 		}
 		@modified_bugs = @modified_bugs2;
 	}
@@ -163,9 +173,7 @@
 
 	# Used to chache binary to source mappings
 	my %binarytosource = ();
-	# XXX What if a bug is in location 'db' (which currently 
 	my $location = $src_config{archived} ? 'archive' : 'db_h';
-	#my $table = $src_config{archived} ? 'bugs_archived' : 'bugs';
 	$table = $src_config{archived} ? $archived_table : $table;
 	# Read all bugs
 	my $insert_bugs_handle = $dbh->prepare("INSERT INTO $table VALUES (\$1, \$2, \$3, \$4::abstime, \$5, \$6, \$7, \$8, \$9, \$10::abstime, \$11, \$12, \$13)");
@@ -176,7 +184,6 @@
 	$insert_bugs_handle->bind_param(4, undef, SQL_INTEGER);
 	$insert_bugs_handle->bind_param(10, undef, SQL_INTEGER);
 
-	print "Inserting bugs: ",(time() - $t),"s\n" if $timing;
 	$t = time();
 	foreach my $bug_nr (@modified_bugs) {
 		# Fetch bug using Debbugs
@@ -269,9 +276,7 @@
 			$insert_bugs_tags_handle->execute($bug_nr, $tag) or die $!;
 		}
 	}
-	
-	# Also import usertags
-	run_usertags($config, $source, $dbh);
+	print "Inserting bugs: ",(time() - $t),"s\n" if $timing;
 }
 
 sub main {




More information about the Collab-qa-commits mailing list