From: Don Armstrong Date: Tue, 24 Sep 2013 05:35:49 +0000 (-0700) Subject: Merge branch 'master' into database X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=cb3305f824d80ab3f9485b9fcba7b52b94ca417c;hp=-c;p=debbugs.git Merge branch 'master' into database --- cb3305f824d80ab3f9485b9fcba7b52b94ca417c diff --combined Debbugs/Status.pm index ab35b81,b28ff53..1dc6ef8 --- a/Debbugs/Status.pm +++ b/Debbugs/Status.pm @@@ -191,7 -191,6 +191,7 @@@ sub read_bug my $status; my $log; my $location; + my $report; if (not defined $param{summary}) { my $lref; ($lref,$location) = @param{qw(bug location)}; @@@ -201,16 -200,13 +201,16 @@@ } $status = getbugcomponent($lref, 'summary', $location); $log = getbugcomponent($lref, 'log' , $location); + $report = getbugcomponent($lref, 'report' , $location); return undef unless defined $status; return undef if not -e $status; } else { $status = $param{summary}; $log = $status; + $report = $status; $log =~ s/\.summary$/.log/; + $report =~ s/\.summary$/.report/; ($location) = $status =~ m/(db-h|db|archive)/; ($param{bug}) = $status =~ m/(\d+)\.summary$/; } @@@ -281,12 -277,7 +281,12 @@@ my $status_modified = (stat($status))[9]; # Add log last modified time $data{log_modified} = (stat($log))[9] // (stat("${log}.gz"))[9]; + my $report_modified = (stat($report))[9] // $data{log_modified}; $data{last_modified} = max($status_modified,$data{log_modified}); + # if the date isn't set (ancient bug), use the smallest of any of the modified + if (not defined $data{date} or not length($data{date})) { + $data{date} = min($report_modified,$status_modified,$data{log_modified}); + } $data{location} = $location; $data{archived} = (defined($location) and ($location eq 'archive'))?1:0; $data{bug_num} = $param{bug}; @@@ -521,12 -512,14 +521,14 @@@ sub lock_read_all_merged_bugs push @data,$newdata; # perform a sanity check to make sure that the merged bugs # are all merged with eachother - my $expectmerge= join(' ',grep {$_ != $bug } sort { $a <=> $b } @bugs); + # We do a cmp sort instead of an <=> sort here, because that's + # what merge does + my $expectmerge= join(' ',grep {$_ != $bug } sort @bugs); if ($newdata->{mergedwith} ne $expectmerge) { for (1..$locks) { unfilelock(exists $param{locks}?$param{locks}:()); } - die "Bug $param{bug} differs from bug $bug: ($newdata->{bug_num}: '$newdata->{mergedwith}') vs. ('$expectmerge') (".join(' ',@bugs).")"; + die "Bug $param{bug} mergedwith differs from bug $bug: ($newdata->{bug_num}: '$newdata->{mergedwith}') vs. ('$expectmerge') (".join(' ',@bugs).")"; } } }