From: Joey Hess Date: Thu, 18 Oct 2007 19:20:19 +0000 (-0400) Subject: * Add the -n switch, for disabling recursion. X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/3d2a8945576fea043684b12847ed647171111874?ds=sidebyside * Add the -n switch, for disabling recursion. --- diff --git a/debian/changelog b/debian/changelog index 8fa6c09..ef53f9f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ mr (0.4) UNRELEASED; urgency=low * Ensure parent dir exists prior to checkout. (madduck) * Output list of failed repos to stderr when -s is used. * Fix a bug caused by a stupid typo. + * Add the -n switch, for disabling recursion. - -- Joey Hess Thu, 18 Oct 2007 15:00:00 -0400 + -- Joey Hess Thu, 18 Oct 2007 15:18:40 -0400 mr (0.3) unstable; urgency=low diff --git a/mr b/mr index e41264c..44fb671 100755 --- a/mr +++ b/mr @@ -146,6 +146,11 @@ Be verbose. 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 @@ -259,6 +264,7 @@ $ENV{MR_CONFIG}="$ENV{HOME}/.mrconfig"; my $directory=getcwd(); my $verbose=0; my $stats=0; +my $no_recurse=0; my %config; my %knownactions; my %alias; @@ -269,6 +275,7 @@ my $result=GetOptions( "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". @@ -362,6 +369,7 @@ foreach my $topdir (sort keys %config) { my $d=$directory; $dir.="/" unless $dir=~/\/$/; $d.="/" unless $d=~/\/$/; + next if $no_recurse && $d ne $dir; next if $dir ne $d && $dir !~ /^\Q$d\E/; push @repos, [$dir, $topdir, $subdir]; }