WIP: slight updates to What's cooking script

todo
Junio C Hamano 2008-11-05 17:03:43 -08:00
parent 7497fdb569
commit 55dd4b0bc0
2 changed files with 31 additions and 10 deletions

35
UWC
View File

@ -2,7 +2,7 @@
#
# Update an older edition of What's Cooking with the latest data.
#
# Usage: UWC [ old [ new ] ]
# Usage: UWC [--keep-master] [ old [ new ] ]
#
# Giving no parameter is the same as giving a single "-" to the command.
#
@ -28,6 +28,8 @@
# previously sent in a buffer in Emacs, and filter the buffer contents
# with this script, to prepare an up-to-date message.

my $keep_master = 1;

sub parse_whats_cooking {
my ($fh) = @_;
my $head = undef;
@ -179,15 +181,27 @@ sub merge_whats_cooking {
}
}

if (%{$new_wc->{"topic hash"}}) {
if (@gone) {
$group = 'Graduated to "master"';
if (!exists $old_wc->{" $group"}) {
unshift @{$old_wc->{"group list"}}, $group;
$old_wc->{" $group"} = [];
}
push @{$old_wc->{" $group"}}, @gone;

$group = 'Graduated to "master"';
if (!$keep_master) {
print STDERR "Not Keeping Master\n";
my $o = delete $old_wc->{" $group"};
for (@$o) {
print STDERR " Dropping: ", $_->{'topic'}, "\n";
}
print STDERR "Gone are\n";
for (@gone) {
print STDERR " Gone: ", $_->{'topic'}, "\n";
}
}
if (@gone) {
if (!exists $old_wc->{" $group"}) {
unshift @{$old_wc->{"group list"}}, $group;
$old_wc->{" $group"} = [];
}
push @{$old_wc->{" $group"}}, @gone;
}
if (%{$new_wc->{"topic hash"}}) {
$group = "New Topics";
if (!exists $old_wc->{" $group"}) {
unshift @{$old_wc->{"group list"}}, $group;
@ -204,6 +218,9 @@ sub merge_whats_cooking {

if (@ARGV == 0) {
@ARGV = ('-');
} elsif ($ARGV[0] eq '--keep-master') {
$keep_master = 1;
shift;
}
if (@ARGV != 2 && @ARGV != 1) {
die "Usage: $0 old [new]\n";

6
WC
View File

@ -4,6 +4,7 @@
master_at=$(git rev-parse --verify refs/heads/master)
next_at=$(git rev-parse --verify refs/heads/next)

keep_master=
case "$1" in
generate)
echo Here are the topics that have been
@ -11,6 +12,9 @@ generate)
Meta/git-topic.perl --base=master | sed -e 's/^\*./\n*/'
exit
;;
keep)
keep_master=--keep-master
;;
esac

eval $(LC_ALL=C date +"monthname=%b month=%m year=%Y date=%d dow=%a")
@ -48,4 +52,4 @@ last=$(
)

sed -e 's/^\[New Topics\]$/[Old New Topics]/' "Meta/$last" |
Meta/UWC
Meta/UWC $keep_master