WIP: slight updates to What's cooking script
Junio C Hamano committed
Nov 5, 2008 at 17:03 UTC
55dd4b0bc01030de338a9694b70aaebc0c65d494
2 files changed
+31
-10
UWC
+26
-9
@@ -2,7 +2,7 @@
2
#
3
# Update an older edition of What's Cooking with the latest data.
4
#
5
-# Usage: UWC [ old [ new ] ]
5
+# Usage: UWC [--keep-master] [ old [ new ] ]
6
#
7
# Giving no parameter is the same as giving a single "-" to the command.
8
#
@@ -28,6 +28,8 @@
28
# previously sent in a buffer in Emacs, and filter the buffer contents
29
# with this script, to prepare an up-to-date message.
30
31
+my $keep_master = 1;
32
+
33
sub parse_whats_cooking {
34
my ($fh) = @_;
35
my $head = undef;
@@ -179,15 +181,27 @@ sub merge_whats_cooking {
181
}
182
}
183
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"} = [];
201
}
202
+ push @{$old_wc->{" $group"}}, @gone;
203
+ }
204
+ if (%{$new_wc->{"topic hash"}}) {
205
$group = "New Topics";
206
if (!exists $old_wc->{" $group"}) {
207
unshift @{$old_wc->{"group list"}}, $group;
@@ -204,6 +218,9 @@ sub merge_whats_cooking {
218
219
if (@ARGV == 0) {
220
@ARGV = ('-');
221
+} elsif ($ARGV[0] eq '--keep-master') {
222
+ $keep_master = 1;
223
+ shift;
224
}
225
if (@ARGV != 2 && @ARGV != 1) {
226
die "Usage: $0 old [new]\n";
WC
+5
-1
@@ -4,6 +4,7 @@
4
master_at=$(git rev-parse --verify refs/heads/master)
5
next_at=$(git rev-parse --verify refs/heads/next)
6
7
+keep_master=
8
case "$1" in
9
generate)
10
echo Here are the topics that have been
@@ -11,6 +12,9 @@ generate)
12
Meta/git-topic.perl --base=master | sed -e 's/^\*./\n*/'
13
exit
14
;;
15
+keep)
16
+ keep_master=--keep-master
17
+ ;;
18
esac
19
20
eval $(LC_ALL=C date +"monthname=%b month=%m year=%Y date=%d dow=%a")
@@ -48,4 +52,4 @@ last=$(
52
)
53
54
sed -e 's/^\[New Topics\]$/[Old New Topics]/' "Meta/$last" |
51
-Meta/UWC
55
+Meta/UWC $keep_master