From f13d7e675e5c3a29fd4b5430119ef3454f7e165e Mon Sep 17 00:00:00 2001 From: Richard Lowe Date: Wed, 7 Dec 2011 03:47:44 +0000 Subject: webrev: Don't care about ephemerally changed files If files are added then removed, or changed and then reset, don't show them in the webrev. We do this by moving the call to whatchanged into the perl itself, and then effectively doing a join on filename between the 'diff' file list, and the whatchanged file list. --- usr/src/tools/scripts/webrev.sh | 45 ++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'usr/src/tools/scripts') diff --git a/usr/src/tools/scripts/webrev.sh b/usr/src/tools/scripts/webrev.sh index 1a987dc7bc..f55df21969 100644 --- a/usr/src/tools/scripts/webrev.sh +++ b/usr/src/tools/scripts/webrev.sh @@ -1798,24 +1798,37 @@ function git_wxfile typeset parent="$2" TMPFLIST=/tmp/$$.active - $GIT whatchanged --pretty=format:'%B' "${parent}".. |\ - $PERL -e 'my (%files, $msg); - my $state = 1; # 0|comments, 1|files - while (<>) { - chomp; - if (/^:[0-9]{6}/) { - my $fname = (split /\t/, $_)[1]; - $state = 1; - $files{$fname} = $msg; - } else { - if ($state == 1) { - $state = 0; - $msg = /^\n/ ? "" : "\n"; - } - $msg .= "$_\n" if ($_); + $PERL -e 'my (%files, %realfiles, $msg); + my $state = 1; # 0|comments, 1|files + my $branch = $ARGV[0]; + + open(F, "git diff -M --name-only $branch |"); + while () { + chomp; + $realfiles{$_} = 1; + } + close(F); + + open(F, "git whatchanged --pretty=format:\"%B\" $branch.. |"); + while () { + chomp; + if (/^:[0-9]{6}/) { + my $fname = (split /\t/, $_)[1]; + $state = 1; + $files{$fname} = $msg; + } else { + if ($state == 1) { + $state = 0; + $msg = /^\n/ ? "" : "\n"; } + $msg .= "$_\n" if ($_); } - print "$_\n$files{$_}\n" for (sort keys %files);'> $TMPFLIST + } + close(F); + + for (sort keys %files) { + print "$_\n$files{$_}\n" if defined $realfiles{$_}; + }' ${parent} > $TMPFLIST wxfile=$TMPFLIST } -- cgit v1.2.3