Expand the statistics line displayed at the end to include information
about exactly which repositories failed and were skipped, if any.
+=item -n
+
+Just operate on the repository for the current directory, do not
+recurse into deeper repositories.
+
=back
=head1 FILES
my $directory=getcwd();
my $verbose=0;
my $stats=0;
+my $no_recurse=0;
my %config;
my %knownactions;
my %alias;
"c|config=s" => sub { $ENV{MR_CONFIG}=abs_path($_[1]) },
"v|verbose" => \$verbose,
"s|stats" => \$stats,
+ "n|no-recurse" => \$no_recurse,
);
if (! $result || @ARGV < 1) {
die("Usage: mr [-d directory] action [params ...]\n".
}
my $section=shift;
if ($section=~/^\//) {
- # try to convert to a path relative to $config's dir
+ # try to convert to a path relative to the config file
my ($dir)=$ENV{MR_CONFIG}=~/^(.*\/)[^\/]+$/;
if ($section=~/^\Q$dir\E(.*)/) {
$section=$1;
my $d=$directory;
$dir.="/" unless $dir=~/\/$/;
$d.="/" unless $d=~/\/$/;
- next if $dir ne $directory && $dir !~ /^\Q$directory\E/;
+ next if $no_recurse && $d ne $dir;
+ next if $dir ne $d && $dir !~ /^\Q$d\E/;
push @repos, [$dir, $topdir, $subdir];
}
}
}
$dir=~s/^(.*)\/[^\/]+\/?$/$1/;
+
if (! -d $dir) {
print "mr $action: creating parent directory $dir\n" if $verbose;
- mkdir $dir;
+ my $ret=system("mkdir", "-p", $dir);
}
}
elsif ($action eq 'update') {
print "mr $action: (skipped: ".join(" ", @skipped).")\n";
}
if (@failed) {
- print "mr $action: (failed: ".join(" ", @failed).")\n";
+ print STDERR "mr $action: (failed: ".join(" ", @failed).")\n";
}
}
if (@failed) {