From 8bf314b5bb3d6c96735b221083037dc035196a89 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 22 Mar 2012 19:29:16 -0700 Subject: [PATCH] try every bug in a changeset on every attempt --- Debbugs/Control.pm | 115 +++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 7e56223..915b674 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -2088,66 +2088,69 @@ sub set_merged { croak "Did not alter merged bugs"; } } - my ($change_bug) = keys %{$changes}; - $bug_changed{$change_bug}++; - print {$transcript} __bug_info($data{$change_bug}) if - $param{show_bug_info} and not __internal_request(1); - $bug_info_shown{$change_bug} = 1; - __allow_relocking($param{locks},[keys %data]); - for my $change (@{$changes->{$change_bug}}) { - if ($change->{field} eq 'blockedby' or $change->{field} eq 'blocks') { - my %target_blockedby; - @target_blockedby{@{$change->{func_value}}} = (1) x @{$change->{func_value}}; - my %unhandled_targets = %target_blockedby; - my @blocks_to_remove; - for my $key (split / /,$change->{orig_value}) { - delete $unhandled_targets{$key}; - next if exists $target_blockedby{$key}; - set_blocks(bug => $change->{field} eq 'blocks' ? $key : $change->{bug}, - block => $change->{field} eq 'blocks' ? $change->{bug} : $key, - remove => 1, - hash_slice(%param, - keys %common_options, - keys %append_action_options), - ); + my @bugs_to_change = keys %{$changes}; + for my $change_bug (@bugs_to_change) { + next unless exists $changes->{$change_bug}; + $bug_changed{$change_bug}++; + print {$transcript} __bug_info($data{$change_bug}) if + $param{show_bug_info} and not __internal_request(1); + $bug_info_shown{$change_bug} = 1; + __allow_relocking($param{locks},[keys %data]); + for my $change (@{$changes->{$change_bug}}) { + if ($change->{field} eq 'blockedby' or $change->{field} eq 'blocks') { + my %target_blockedby; + @target_blockedby{@{$change->{func_value}}} = (1) x @{$change->{func_value}}; + my %unhandled_targets = %target_blockedby; + my @blocks_to_remove; + for my $key (split / /,$change->{orig_value}) { + delete $unhandled_targets{$key}; + next if exists $target_blockedby{$key}; + set_blocks(bug => $change->{field} eq 'blocks' ? $key : $change->{bug}, + block => $change->{field} eq 'blocks' ? $change->{bug} : $key, + remove => 1, + hash_slice(%param, + keys %common_options, + keys %append_action_options), + ); + } + for my $key (keys %unhandled_targets) { + set_blocks(bug => $change->{field} eq 'blocks' ? $key : $change->{bug}, + block => $change->{field} eq 'blocks' ? $change->{bug} : $key, + add => 1, + hash_slice(%param, + keys %common_options, + keys %append_action_options), + ); + } } - for my $key (keys %unhandled_targets) { - set_blocks(bug => $change->{field} eq 'blocks' ? $key : $change->{bug}, - block => $change->{field} eq 'blocks' ? $change->{bug} : $key, - add => 1, - hash_slice(%param, - keys %common_options, - keys %append_action_options), - ); + else { + $change->{function}->(bug => $change->{bug}, + $change->{key}, $change->{func_value}, + exists $change->{options}?@{$change->{options}}:(), + hash_slice(%param, + keys %common_options, + keys %append_action_options), + ); } } - else { - $change->{function}->(bug => $change->{bug}, - $change->{key}, $change->{func_value}, - exists $change->{options}?@{$change->{options}}:(), - hash_slice(%param, - keys %common_options, - keys %append_action_options), - ); - } + __disallow_relocking($param{locks}); + my ($data,$n_locks) = + __lock_and_load_merged_bugs(bugs_to_load => [keys %merging], + data => \@data, + locks => $param{locks}, + debug => $debug, + reload_all => 1, + ); + $new_locks += $n_locks; + $locks += $n_locks; + %data = %{$data}; + @data = values %data; + ($merge_status,$bugs_to_merge) = + __calculate_merge_status(\@data,\%data,$param{bug},$merge_status); + ($disallowed_changes,$changes) = + __calculate_merge_changes(\@data,$merge_status,\%param); + $attempts = max(values %bug_changed); } - __disallow_relocking($param{locks}); - my ($data,$n_locks) = - __lock_and_load_merged_bugs(bugs_to_load => [keys %merging], - data => \@data, - locks => $param{locks}, - debug => $debug, - reload_all => 1, - ); - $new_locks += $n_locks; - $locks += $n_locks; - %data = %{$data}; - @data = values %data; - ($merge_status,$bugs_to_merge) = - __calculate_merge_status(\@data,\%data,$param{bug},$merge_status); - ($disallowed_changes,$changes) = - __calculate_merge_changes(\@data,$merge_status,\%param); - $attempts = max(values %bug_changed); } if ($param{show_bug_info} and not __internal_request(1)) { for my $data (sort {$a->{bug_num} <=> $b->{bug_num}} @data) { -- 2.39.2