* [PATCH] scripts/get_maintainer.pl: add ability to read from STDIN @ 2010-02-02 18:30 Daniel Mack 2010-02-03 5:35 ` Joe Perches 0 siblings, 1 reply; 4+ messages in thread From: Daniel Mack @ 2010-02-02 18:30 UTC (permalink / raw) To: linux-kernel; +Cc: Daniel Mack, Joe Perches, Andrew Morton This is useful for finding people for the Cc: list without dumping the patch to a file before. You can just run git diff --cached | scripts/get_maintainer.pl - now. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Joe Perches <joe@perches.com> Cc: Andrew Morton <akpm@linux-foundation.org> --- scripts/get_maintainer.pl | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 090f248..3394131 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -237,7 +237,7 @@ foreach my $file (@ARGV) { ##if $file is a directory and it lacks a trailing slash, add one if ((-d $file)) { $file =~ s@([^/])$@$1/@; - } elsif (!(-f $file)) { + } elsif ($file ne "-" && !(-f $file)) { die "$P: file '${file}' not found\n"; } if ($from_filename) { @@ -255,7 +255,11 @@ foreach my $file (@ARGV) { } else { my $file_cnt = @files; my $lastfile; - open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; + if ($file eq "-") { + open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; + } else { + open(PATCH, "<") or die "$P: Can't read from STDIN\n"; + } while (<PATCH>) { my $patch_line = $_; if (m/^\+\+\+\s+(\S+)/) { @@ -496,6 +500,7 @@ Notes: --git-min-signatures, --git-max-maintainers, --git-min-percent, and --git-blame Use --hg-since not --git-since to control date selection + You can pass '-' as argument to read the patch file from STDIN EOT } -- 1.6.3.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scripts/get_maintainer.pl: add ability to read from STDIN 2010-02-02 18:30 [PATCH] scripts/get_maintainer.pl: add ability to read from STDIN Daniel Mack @ 2010-02-03 5:35 ` Joe Perches 2010-02-03 7:27 ` Borislav Petkov 0 siblings, 1 reply; 4+ messages in thread From: Joe Perches @ 2010-02-03 5:35 UTC (permalink / raw) To: Daniel Mack; +Cc: linux-kernel, Andrew Morton On Wed, 2010-02-03 at 02:30 +0800, Daniel Mack wrote: > This is useful for finding people for the Cc: list without dumping the > patch to a file before. Hi Daniel. I think it's better if the dash isn't required. I like this patch which is based on your idea. http://patchwork.kernel.org/patch/69650/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scripts/get_maintainer.pl: add ability to read from STDIN 2010-02-03 5:35 ` Joe Perches @ 2010-02-03 7:27 ` Borislav Petkov 2010-02-03 20:34 ` Joe Perches 0 siblings, 1 reply; 4+ messages in thread From: Borislav Petkov @ 2010-02-03 7:27 UTC (permalink / raw) To: Joe Perches; +Cc: Daniel Mack, linux-kernel, Andrew Morton On Tue, Feb 02, 2010 at 09:35:47PM -0800, Joe Perches wrote: > On Wed, 2010-02-03 at 02:30 +0800, Daniel Mack wrote: > > This is useful for finding people for the Cc: list without dumping the > > patch to a file before. > > Hi Daniel. > > I think it's better if the dash isn't required. > I like this patch which is based on your idea. > > http://patchwork.kernel.org/patch/69650/ Yeah, about that, when are you going to send it upstream? Or do you want me to do that? -- Regards/Gruss, Boris. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] scripts/get_maintainer.pl: add ability to read from STDIN 2010-02-03 7:27 ` Borislav Petkov @ 2010-02-03 20:34 ` Joe Perches 0 siblings, 0 replies; 4+ messages in thread From: Joe Perches @ 2010-02-03 20:34 UTC (permalink / raw) To: Borislav Petkov, Andrew Morton; +Cc: Daniel Mack, linux-kernel On Wed, 2010-02-03 at 08:27 +0100, Borislav Petkov wrote: > On Tue, Feb 02, 2010 at 09:35:47PM -0800, Joe Perches wrote: > > I think it's better if the dash isn't required. > > > > http://patchwork.kernel.org/patch/69650/ > > Yeah, about that, when are you going to send it upstream? Or do you want > me to do that? I already sent it to Andrew Morton but I think he was away for the holidays then. Andrew, can you pick this one up please for the next not-rc release? Doesn't need or accept '-' as a trailing option to read stdin. Doesn't print usage() after bad options. Adds --usage as command line equivalent of --help Suggested-by: Borislav Petkov <petkovbb@googlemail.com> Signed-off-by: Joe Perches <joe@perches.com> --- diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 445e884..9fe4628 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -122,7 +122,7 @@ if (!GetOptions( 'k|keywords!' => \$keywords, 'f|file' => \$from_filename, 'v|version' => \$version, - 'h|help' => \$help, + 'h|help|usage' => \$help, )) { die "$P: invalid argument - use --help if necessary\n"; } @@ -137,9 +137,9 @@ if ($version != 0) { exit 0; } -if ($#ARGV < 0) { - usage(); - die "$P: argument missing: patchfile or -f file please\n"; +if (-t STDIN && !@ARGV) { + # We're talking to a terminal, but have no command line arguments. + die "$P: missing patchfile or -f file - use --help if necessary\n"; } if ($output_separator ne ", ") { @@ -152,14 +152,12 @@ if ($output_rolestats) { my $selections = $email + $scm + $status + $subsystem + $web; if ($selections == 0) { - usage(); die "$P: Missing required option: email, scm, status, subsystem or web\n"; } if ($email && ($email_maintainer + $email_list + $email_subscriber_list + $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { - usage(); die "$P: Please select at least 1 email option\n"; } @@ -233,12 +231,18 @@ my @files = (); my @range = (); my @keyword_tvi = (); +if (!@ARGV) { + push(@ARGV, "&STDIN"); +} + foreach my $file (@ARGV) { - ##if $file is a directory and it lacks a trailing slash, add one - if ((-d $file)) { - $file =~ s@([^/])$@$1/@; - } elsif (!(-f $file)) { - die "$P: file '${file}' not found\n"; + if ($file ne "&STDIN") { + ##if $file is a directory and it lacks a trailing slash, add one + if ((-d $file)) { + $file =~ s@([^/])$@$1/@; + } elsif (!(-f $file)) { + die "$P: file '${file}' not found\n"; + } } if ($from_filename) { push(@files, $file); ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-03 20:34 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-02-02 18:30 [PATCH] scripts/get_maintainer.pl: add ability to read from STDIN Daniel Mack 2010-02-03 5:35 ` Joe Perches 2010-02-03 7:27 ` Borislav Petkov 2010-02-03 20:34 ` Joe Perches
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®