[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patch
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patches or files |
Date: |
Wed, 12 Dec 2018 16:22:26 +0100 |
Similar to how patchew output looks like for multiple patches,
say what file or patch is being tested _before_ emitting errors.
This is clearer to a human that scans the output from top to
bottom.
In addition, provide a truncated commit hash and subject instead of
the full hash, and process the commits first-to-last rather than
last-to-first.
Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c
("checkpatch: reduce number of `git log` calls with --git", 2016-03-20).
Signed-off-by: Paolo Bonzini <address@hidden>
---
scripts/checkpatch.pl | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 506aa6c..2edb4e2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -340,13 +340,18 @@ my @lines = ();
my $vname;
if ($chk_branch) {
my @patches;
+ my %git_commits = ();
my $HASH;
- open($HASH, "-|", "git", "log", "--format=%H", $ARGV[0]) ||
- die "$P: git log --format=%H $ARGV[0] failed - $!\n";
-
- while (<$HASH>) {
- chomp;
- push @patches, $_;
+ open($HASH, "-|", "git", "log", "--reverse", "--no-merges",
"--format=%H %s", $ARGV[0]) ||
+ die "$P: git log --reverse --no-merges --format='%H %s'
$ARGV[0] failed - $!\n";
+
+ for my $line (<$HASH>) {
+ $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
+ next if (!defined($1) || !defined($2));
+ my $sha1 = $1;
+ my $subject = $2;
+ push(@patches, $sha1);
+ $git_commits{$sha1} = $subject;
}
close $HASH;
@@ -354,21 +359,31 @@ if ($chk_branch) {
die "$P: no revisions returned for revlist '$chk_branch'\n"
unless @patches;
+ my $i = 1;
+ my $num_patches = @patches;
for my $hash (@patches) {
my $FILE;
open($FILE, '-|', "git", "show", $hash) ||
die "$P: git show $hash - $!\n";
- $vname = $hash;
while (<$FILE>) {
chomp;
push(@rawlines, $_);
}
close($FILE);
+ $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} .
')';
+ if ($num_patches > 1 && $quiet == 0) {
+ print "$i/$num_patches Checking commit $vname\n";
+ $vname = "Patch $i/$num_patches";
+ } else {
+ $vname = "Commit " . $vname;
+ }
if (!process($hash)) {
$exit = 1;
+ print "\n" if ($num_patches > 1 && $quiet == 0);
}
@rawlines = ();
@lines = ();
+ $i++;
}
} else {
for my $filename (@ARGV) {
@@ -387,6 +402,7 @@ if ($chk_branch) {
} else {
$vname = $filename;
}
+ print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0;
while (<$FILE>) {
chomp;
push(@rawlines, $_);
--
1.8.3.1
- [Qemu-devel] [PULL 00/54] Misc patches for 2018-12-12, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 01/54] accel: Improve selection of the default accelerator, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 11/54] hax: Support for Linux hosts, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 04/54] checkpatch: check Signed-off-by in --mailback mode, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 09/54] memory: avoid unnecessary coalesced_io_del operations, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 08/54] memory: extract flat_range_coalesced_io_{del, add}, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 14/54] block/iscsi: fix ioctl cancel use-after-free, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patches or files,
Paolo Bonzini <=
- [Qemu-devel] [PULL 20/54] build-sys: build with Vista API by default, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 07/54] pam: wrap MemoryRegion initialization in a transaction, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 03/54] checkpatch: fix premature exit when no input or --mailback, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 06/54] checkpatch: colorize output to terminal, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 25/54] qemu/queue.h: do not access tqe_prev directly, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 24/54] compiler.h: Add an explicit check for the compiler version, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 13/54] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events(), Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 16/54] esp-pci: Fix status register write erase control, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 15/54] block/iscsi: cancel libiscsi task when ABORT TASK TMF completes, Paolo Bonzini, 2018/12/12