Package: mr
Version: 0.14
Severity: wishlist
Tags: patch

With the attached patch, mr will accept -j with no argument, and run
unlimited jobs in parallel, like make -j.

I would have preferred to set $jobs to bignum::inf, which would have
confined the impact of the change to the argument parsing.  However,
using bignum breaks getopt.

- Josh Triplett

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- no debconf information
>From 73d669c5151637f1d0a0191196e442b0d51743d5 Mon Sep 17 00:00:00 2001
From: Josh Triplett <[EMAIL PROTECTED]>
Date: Thu, 22 Nov 2007 19:57:38 -0800
Subject: [PATCH] * Make -j with no argument run unlimited jobs in parallel, 
like make -j

---
 debian/changelog |    7 +++++++
 mr               |   14 +++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index df12431..e2ad59b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mr (0.15) unstable; urgency=low
+
+  [ Josh Triplett ]
+  * Make -j with no argument run unlimited jobs in parallel, like make -j
+
+ -- Joey Hess <[EMAIL PROTECTED]>  Thu, 22 Nov 2007 19:55:58 -0800
+
 mr (0.14) unstable; urgency=low
 
   * Portability fixes for the non-POSIX shell of SunOS 5. Patch from Ken
diff --git a/mr b/mr
index 5e0ac7f..c37cd92 100755
--- a/mr
+++ b/mr
@@ -157,11 +157,11 @@ about exactly which repositories failed and were skipped, 
if any.
 Just operate on the repository for the current directory, do not 
 recurse into deeper repositories.
 
-=item -j number
+=item -j [number]
 
-Run the specified number of jobs in parallel. This can greatly speed up
-operations such as updates. It is not recommended for interactive
-operations.
+Run the specified number of jobs in parallel, or an unlimited number of jobs
+with no number specified. This can greatly speed up operations such as updates.
+It is not recommended for interactive operations.
 
 =back
 
@@ -506,7 +506,7 @@ sub mrs { #{{{
        my @out;
        my $running=0;
        while (@fhs or @repos) {
-               while ($running < $jobs && @repos) {
+               while ((!$jobs || $running < $jobs) && @repos) {
                        $running++;
                        my $repo = shift @repos;
                        pipe(my $outfh, CHILD_STDOUT);
@@ -919,7 +919,7 @@ sub dispatch { #{{{
                register(@ARGV);
        }
 
-       if ($jobs > 1) {
+       if (!$jobs || $jobs > 1) {
                mrs($action, selectrepos());
        }
        else {
@@ -1043,7 +1043,7 @@ sub getopts { #{{{
                "v|verbose" => \$verbose,
                "s|stats" => \$stats,
                "n|no-recurse" => \$no_recurse,
-               "j|jobs=i" => \$jobs,
+               "j|jobs:i" => \$jobs,
        );
        if (! $result || @ARGV < 1) {
                die("Usage: mr [-d directory] action [params ...]\n".
-- 
1.5.3.6

Reply via email to