From: Junio C Hamano Date: Thu, 6 Nov 2008 01:03:43 +0000 (-0800) Subject: WIP: slight updates to What's cooking script X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55dd4b0bc01030de338a9694b70aaebc0c65d494;p=thirdparty%2Fgit.git WIP: slight updates to What's cooking script --- diff --git a/UWC b/UWC index 7391dedc9f..7a513af2ee 100755 --- a/UWC +++ b/UWC @@ -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"; diff --git a/WC b/WC index 3e60c3ad79..ef1bda7518 100755 --- a/WC +++ b/WC @@ -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