]> git.madduck.net Git - code/myrepos.git/blobdiff - mr

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

just a few more functions..
[code/myrepos.git] / mr
diff --git a/mr b/mr
index 8108762c2ee95e896c3343ac7a1cbf41c6b0ad38..2187aa06b59472cc9c13dfe5367bdd9b4ef59b45 100755 (executable)
--- a/mr
+++ b/mr
@@ -321,6 +321,7 @@ my %configfiles;
 my %knownactions;
 my %alias;
 my $directory=getcwd();
+my (@ok, @failed, @skipped);
 
 getopts();
 
@@ -347,29 +348,8 @@ loadconfig($ENV{MR_CONFIG});
 #print Dumper(\%config);
 
 my $action=expandaction(shift @ARGV);
-
-# actions that do not operate on all repos
-if ($action eq 'help') {
-       help(@ARGV);
-}
-elsif ($action eq 'config') {
-       config(@ARGV);
-}
-elsif ($action eq 'register') {
-       register(@ARGV);
-}
-
-my (@ok, @failed, @skipped);
-if ($jobs > 1) {
-       mrs(selectrepos());
-}
-else {
-       foreach my $repo (selectrepos()) {
-               record($repo, action($action, @$repo));
-       }
-}
-
-showstats();
+dispatch($action);
+showstats($action);
 
 if (@failed) {
        exit 1;
@@ -377,7 +357,33 @@ if (@failed) {
 elsif (! @ok && @skipped) {
        exit 1;
 }
-exit 0;
+else {
+       exit 0;
+}
+
+sub dispatch { #{{{
+       my $action=shift;
+
+       # actions that do not operate on all repos
+       if ($action eq 'help') {
+               help(@ARGV);
+       }
+       elsif ($action eq 'config') {
+               config(@ARGV);
+       }
+       elsif ($action eq 'register') {
+               register(@ARGV);
+       }
+
+       if ($jobs > 1) {
+               mrs($action, selectrepos());
+       }
+       else {
+               foreach my $repo (selectrepos()) {
+                       record($repo, action($action, @$repo));
+               }
+       }
+} #}}}
 
 sub rcs_test { #{{{
        my ($action, $dir, $topdir, $subdir) = @_;
@@ -537,6 +543,7 @@ sub action { #{{{
 
 # run actions on multiple repos, in parallel
 sub mrs { #{{{
+       my $action=shift;
        my @repos=@_;
 
        $| = 1;