]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Status.pm
Fix default user for usertags
[debbugs.git] / Debbugs / Status.pm
index c9f5709265d9ee3f4cc7be86614def9e34e954de..197b188a6d02c393b084631143c5307e44f589b3 100644 (file)
@@ -282,6 +282,17 @@ sub read_bug{
     $data{archived} = (defined($location) and ($location eq 'archive'))?1:0;
     $data{bug_num} = $param{bug};
 
+    # mergedwith occasionally is sorted badly. Fix it to always be sorted by <=>
+    # and not include this bug
+    if (defined $data{mergedwith} and
+       $data{mergedwith}) {
+       $data{mergedwith} =
+           join(' ',
+                grep { $_ != $data{bug_num}}
+                sort { $a <=> $b }
+                split / /, $data{mergedwith}
+               );
+    }
     return \%data;
 }
 
@@ -516,7 +527,10 @@ sub lock_read_all_merged_bugs {
            # are all merged with eachother
         # We do a cmp sort instead of an <=> sort here, because that's
         # what merge does
-           my $expectmerge= join(' ',grep {$_ != $bug } sort @bugs);
+           my $expectmerge=
+               join(' ',grep {$_ != $bug }
+                    sort { $a <=> $b }
+                    @bugs);
            if ($newdata->{mergedwith} ne $expectmerge) {
                for (1..$locks) {
                    unfilelock(exists $param{locks}?$param{locks}:());
@@ -1206,6 +1220,9 @@ sub get_bug_status {
                                          indicatesource => {type => BOOLEAN,
                                                             default => 1,
                                                            },
+                                         binary_to_source_cache => {type => HASHREF,
+                                                                    optional => 1,
+                                                                   },
                                         },
                              );
      my %status;
@@ -1240,6 +1257,8 @@ sub get_bug_status {
 
      $status{source} = binary_to_source(binary=>[split /\s*,\s*/, $status{package}],
                                        source_only => 1,
+                                       exists $param{binary_to_source_cache}?
+                                       (cache =>$param{binary_to_source_cache}):(),
                                       );
 
      $status{"package"} = 'unknown' if ($status{"package"} eq '');