From 1d52e66eec5f8a0680073613e9284911d34996f3 Mon Sep 17 00:00:00 2001 From: Colin Newell Date: Fri, 15 Apr 2016 16:06:03 +0100 Subject: [PATCH 1/2] Added -l option for simply listing the interesting repo's --- lib/App/Multigit.pm | 1 + lib/App/Multigit/Repo.pm | 2 ++ script/mg | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/lib/App/Multigit.pm b/lib/App/Multigit.pm index d22a916..a33b79e 100644 --- a/lib/App/Multigit.pm +++ b/lib/App/Multigit.pm @@ -83,6 +83,7 @@ our %BEHAVIOUR = ( report_on_no_output => $ENV{MG_REPORT_ON_NO_OUTPUT} // 1, ignore_stdout => !!$ENV{MG_IGNORE_STDOUT}, ignore_stderr => !!$ENV{MG_IGNORE_STDERR}, + list_repos => $ENV{MG_LIST_REPOS}, concurrent => $ENV{MG_CONCURRENT_PROCESSES} // 20, skip_readonly => !!$ENV{MG_SKIP_READONLY}, ); diff --git a/lib/App/Multigit/Repo.pm b/lib/App/Multigit/Repo.pm index 1c793c9..2d0c191 100644 --- a/lib/App/Multigit/Repo.pm +++ b/lib/App/Multigit/Repo.pm @@ -252,6 +252,8 @@ sub report { return Future->done unless $App::Multigit::BEHAVIOUR{report_on_no_output} or $output =~ s/\s//gr; + $output = '' if $App::Multigit::BEHAVIOUR{list_repos}; + return Future->done( $dir => $output ); diff --git a/script/mg b/script/mg index 174d5a9..33c2031 100755 --- a/script/mg +++ b/script/mg @@ -25,6 +25,7 @@ sub usage; 'verbose|v' => sub { $qs--; }, + 'list|l' => \$ENV{MG_LIST_REPOS}, 'concurrent|c=i' => \$ENV{MG_CONCURRENT_PROCESSES}, 'skip-readonly' => \$ENV{MG_SKIP_READONLY}, ); @@ -108,4 +109,15 @@ might use this. Skip readonly repositories. Repositories marked readonly = 1 in the .mgconfig will be ignored by whatever command you run. +=item -l + +=item --list + +List repositories that would produce output. This is useful for piping the list +of repositories to another mg each. + +For example, + + mg -l st -uno | mg each git push + =back From acd7647c9b536444baf09054564748e5cfe20282 Mon Sep 17 00:00:00 2001 From: Colin Newell Date: Fri, 15 Apr 2016 16:09:14 +0100 Subject: [PATCH 2/2] Added note about mg grep --- script/mg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/mg b/script/mg index 33c2031..7ea29fc 100755 --- a/script/mg +++ b/script/mg @@ -120,4 +120,12 @@ For example, mg -l st -uno | mg each git push +Note that mg grep does a very similar thing and may be more appropriate. + + mg grep git not-master + +Is roughly equivalent to, + + mg -lq each git not-master + =back