summaryrefslogtreecommitdiff
path: root/usr/src/tools/scripts
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2011-12-07 03:47:44 +0000
committerRichard Lowe <richlowe@richlowe.net>2011-12-07 03:47:44 +0000
commitf13d7e675e5c3a29fd4b5430119ef3454f7e165e (patch)
tree48d491aa105abccc12c562033fb6586a03302882 /usr/src/tools/scripts
parent2c1887e8fafeb93c323dff027c26104884bfaeb5 (diff)
downloadillumos-joyent-f13d7e675e5c3a29fd4b5430119ef3454f7e165e.tar.gz
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.
Diffstat (limited to 'usr/src/tools/scripts')
-rw-r--r--usr/src/tools/scripts/webrev.sh45
1 files changed, 29 insertions, 16 deletions
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 (<F>) {
+ chomp;
+ $realfiles{$_} = 1;
+ }
+ close(F);
+
+ open(F, "git whatchanged --pretty=format:\"%B\" $branch.. |");
+ while (<F>) {
+ 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
}