Meta/cook: do not lose "graduated to master" when creating a new issue
Junio C Hamano committed
Jun 23, 2010 at 15:03 UTC
16b706d0d5f7dd17dff751bd007fe15db9964bc5
1 file changed
+28
-11
cook
+28
-11
@@ -90,6 +90,21 @@ sub topic_relation {
90
}
91
}
92
93
+=head1
94
+Inspect the current set of topics
95
+
96
+Returns a hash:
97
+
98
+ $topic = {
99
+ $branchname => {
100
+ 'tipdate' => date of the tip commit,
101
+ 'desc' => description string,
102
+ 'log' => [ $commit,... ],
103
+ },
104
+ }
105
+
106
+=cut
107
+
108
sub get_commit {
109
my (@base) = qw(master next pu);
110
my $fh;
@@ -486,16 +501,9 @@ sub update_issue {
501
$sd->{$old_new_topics} = $sd->{$new_topics};
502
}
503
$sd->{$new_topics} = [];
489
-
490
- # Drop "Graduated"
491
- for ($i = 0; $i < @{$sl}; $i++) {
492
- last if ($sl->[$i] eq $graduated)
493
- }
494
- if ($i < @{$sl}) {
495
- splice(@{$sl}, $i, 1);
496
- $sd->{$graduated} = [];
497
- }
504
}
505
+
506
+ return $incremental;
507
}
508
509
sub merge_cooking {
@@ -505,6 +513,7 @@ sub merge_cooking {
513
my $sl = $cooking->{'section_list'};
514
my (@new_topic, @gone_topic);
515
516
+ # Make sure "New Topics" and "Graduated" exists
517
if (!exists $sd->{$new_topics}) {
518
$sd->{$new_topics} = [];
519
unshift @{$sl}, $new_topics;
@@ -515,7 +524,7 @@ sub merge_cooking {
524
unshift @{$sl}, $graduated;
525
}
526
518
- update_issue($cooking);
527
+ my $incremental = update_issue($cooking);
528
529
for my $topic (sort keys %{$current}) {
530
if (!exists $td->{$topic}) {
@@ -531,6 +540,8 @@ sub merge_cooking {
540
541
for my $topic (sort keys %{$td}) {
542
next if ($topic eq $blurb);
543
+ next if (!$incremental &&
544
+ grep { $topic eq $_ } @{$sd->{$graduated}});
545
if (!exists $current->{$topic}) {
546
push @gone_topic, $topic;
547
}
@@ -541,18 +552,24 @@ sub merge_cooking {
552
$td->{$_}{'desc'} = $current->{$_}{'desc'};
553
}
554
555
+ if (!$incremental) {
556
+ $sd->{$graduated} = [];
557
+ }
558
+
559
if (@gone_topic) {
560
for my $topic (@gone_topic) {
561
for my $section (@{$sl}) {
562
+ my $pre = scalar(@{$sd->{$section}});
563
@{$sd->{$section}} = (grep { $_ ne $topic }
564
@{$sd->{$section}});
565
+ my $post = scalar(@{$sd->{$section}});
566
+ next if ($pre == $post);
567
}
568
}
569
for (@gone_topic) {
570
push @{$sd->{$graduated}}, $_;
571
}
572
}
555
-
573
}
574
575
################################################################