require "Maintainers.pl";
use vars qw(%Modules %Maintainers);
-use vars qw(@ISA @EXPORT_OK);
+use vars qw(@ISA @EXPORT_OK $VERSION);
@ISA = qw(Exporter);
@EXPORT_OK = qw(%Modules %Maintainers
get_module_files get_module_pat
show_results process_options);
+$VERSION = 0.02;
require Exporter;
use File::Find;
sub usage {
print <<__EOF__;
-$0: Usage: $0 [[--maintainer M --module M --files]|[--check] file ...]
+$0: Usage: $0 [[--maintainer M --module M --files]|[--check] [commit] | [file ...]
--maintainer M list all maintainers matching M
--module M list all modules matching M
--files list all files
with a file checks if it has a maintainer
with a dir checks all files have a maintainer
otherwise checks for multiple maintainers
---opened list all modules of files opened by perforce
+--opened list all modules of modified files
Matching is case-ignoring regexp, author matching is both by
the short id and by the full name and email. A "module" may
not be just a module, it may be a file or files or a subdirectory.
);
my @Files;
-
+
if ($Opened) {
- @Files = `p4 opened`;
+ chomp (@Files = `git ls-files -m --full-name`);
die if $?;
- foreach (@Files) {
- s!#.*!!s;
- s!^//depot/(?:perl|.*?/perl)/!!;
- }
+ } elsif (@ARGV == 1 &&
+ $ARGV[0] =~ /^(?:HEAD|[0-9a-f]{4,40})(?:~\d+)?\^*$/) {
+ my $command = "git diff --name-only $ARGV[0]^ $ARGV[0]";
+ chomp (@Files = `$command`);
+ die "'$command' failed: $?" if $?;
} else {
@Files = @ARGV;
}
my @files = get_module_files($m);
printf "%-15s @files\n", $m;
} else {
- printf "%-15s $Modules{$m}{MAINTAINER}\n", $m;
+ printf "%-15s %-12s %s\n", $m, $Modules{$m}{MAINTAINER}, $Modules{$m}{UPSTREAM}||'unknown';
}
}
}
if (defined $ModuleByFile{$file}) {
my $module = $ModuleByFile{$file};
my $maintainer = $Modules{$ModuleByFile{$file}}{MAINTAINER};
- printf "%-15s $module $maintainer $Maintainers{$maintainer}\n", $file;
+ my $upstream = $Modules{$module}{UPSTREAM}||'unknown';
+ printf "%-15s [%-7s] $module $maintainer $Maintainers{$maintainer}\n", $file, $upstream;
} else {
printf "%-15s ?\n", $file;
}
}
}
+ elsif ($Opened) {
+ print STDERR "(No files are modified)\n";
+ }
else {
usage();
}