Skip to content

Commit 55dd4b0

Browse files
committed
WIP: slight updates to What's cooking script
1 parent 7497fdb commit 55dd4b0

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

UWC

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Update an older edition of What's Cooking with the latest data.
44
#
5-
# Usage: UWC [ old [ new ] ]
5+
# Usage: UWC [--keep-master] [ old [ new ] ]
66
#
77
# Giving no parameter is the same as giving a single "-" to the command.
88
#
@@ -28,6 +28,8 @@
2828
# previously sent in a buffer in Emacs, and filter the buffer contents
2929
# with this script, to prepare an up-to-date message.
3030

31+
my $keep_master = 1;
32+
3133
sub parse_whats_cooking {
3234
my ($fh) = @_;
3335
my $head = undef;
@@ -179,15 +181,27 @@ sub merge_whats_cooking {
179181
}
180182
}
181183

182-
if (%{$new_wc->{"topic hash"}}) {
183-
if (@gone) {
184-
$group = 'Graduated to "master"';
185-
if (!exists $old_wc->{" $group"}) {
186-
unshift @{$old_wc->{"group list"}}, $group;
187-
$old_wc->{" $group"} = [];
188-
}
189-
push @{$old_wc->{" $group"}}, @gone;
184+
185+
$group = 'Graduated to "master"';
186+
if (!$keep_master) {
187+
print STDERR "Not Keeping Master\n";
188+
my $o = delete $old_wc->{" $group"};
189+
for (@$o) {
190+
print STDERR " Dropping: ", $_->{'topic'}, "\n";
191+
}
192+
print STDERR "Gone are\n";
193+
for (@gone) {
194+
print STDERR " Gone: ", $_->{'topic'}, "\n";
195+
}
196+
}
197+
if (@gone) {
198+
if (!exists $old_wc->{" $group"}) {
199+
unshift @{$old_wc->{"group list"}}, $group;
200+
$old_wc->{" $group"} = [];
190201
}
202+
push @{$old_wc->{" $group"}}, @gone;
203+
}
204+
if (%{$new_wc->{"topic hash"}}) {
191205
$group = "New Topics";
192206
if (!exists $old_wc->{" $group"}) {
193207
unshift @{$old_wc->{"group list"}}, $group;
@@ -204,6 +218,9 @@ sub merge_whats_cooking {
204218

205219
if (@ARGV == 0) {
206220
@ARGV = ('-');
221+
} elsif ($ARGV[0] eq '--keep-master') {
222+
$keep_master = 1;
223+
shift;
207224
}
208225
if (@ARGV != 2 && @ARGV != 1) {
209226
die "Usage: $0 old [new]\n";

WC

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
master_at=$(git rev-parse --verify refs/heads/master)
55
next_at=$(git rev-parse --verify refs/heads/next)
66

7+
keep_master=
78
case "$1" in
89
generate)
910
echo Here are the topics that have been
1011
echo
1112
Meta/git-topic.perl --base=master | sed -e 's/^\*./\n*/'
1213
exit
1314
;;
15+
keep)
16+
keep_master=--keep-master
17+
;;
1418
esac
1519

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

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

0 commit comments

Comments
 (0)