App-Multigit
view release on metacpan or search on metacpan
examples/mg-branch view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;
# mg_each will return a Future representing all the repositories' processes
use App::Multigit qw(mg_each);
# App::Multigit::Script will take care of all the stuff you should be doing in
# all your scripts.
use App::Multigit::Script;
# curry makes it easier to work with the repo objects
use curry;
# For each repository...
my $future = mg_each(sub {
my ($repo) = @_;
# ... run git branch ...
$repo->run([ qw(git branch), @ARGV ])
# ... then report on the outputs.
->finally($repo->curry::report)
});
# finally will gather up all output, whether or not the command succeeded.
# Repo::report will then format it for output as a (directory => output) hash.
my %report = $future->get;
for my $repo (sort keys %report) {
say for $repo, $report{$repo};
}
# POD is used to document the script
=head1 SYNOPSIS
mg-branch ARGV
Runs `git branch argv` on each repository. See `git help branch`.
With no arguments, therefore, this just lists the branches in each
repository.
( run in 0.314 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )