Repository: cordova-coho
Updated Branches:
  refs/heads/master 87b2d44f3 -> 72a982196


Fetch in parallel instead of sequentially for repo-update.


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/dc34ee98
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/dc34ee98
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/dc34ee98

Branch: refs/heads/master
Commit: dc34ee98dec1d4bbc93f21e1169cba50a293ad9a
Parents: 87b2d44
Author: Andrew Grieve <[email protected]>
Authored: Tue Jun 3 21:32:16 2014 -0400
Committer: Andrew Grieve <[email protected]>
Committed: Tue Jun 3 21:32:16 2014 -0400

----------------------------------------------------------------------
 src/executil.js    | 10 ++++++----
 src/repo-update.js |  7 ++++++-
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/dc34ee98/src/executil.js
----------------------------------------------------------------------
diff --git a/src/executil.js b/src/executil.js
index 0625339..1a83630 100644
--- a/src/executil.js
+++ b/src/executil.js
@@ -31,6 +31,10 @@ exports.ARGS = function(s, var_args) {
     return ret;
 }
 
+// silent = false ==> print command and output
+// silent == true or 1 ==> don't print command, don't print output
+// silent == 2 ==> don't print command, print output
+// silent == 3 ==> print command, don't print output
 exports.execHelper = function(cmdAndArgs, silent, allowError) {
     // there are times where we want silent but not allowError.
     if (null == allowError) {
@@ -41,16 +45,14 @@ exports.execHelper = function(cmdAndArgs, silent, 
allowError) {
         gitCommitCount++;
     }
     cmdAndArgs[0] = cmdAndArgs[0].replace(/^git /, 'git -c color.ui=always ');
-    if (!silent) {
+    if (!silent || silent === 3) {
         print('Executing:', cmdAndArgs.join(' '));
     }
-    // silent==2 is used only when modifying ulimit and re-exec'ing,
-    // so don't be silent but allow whatever to happen.
     var result = superspawn.spawn(cmdAndArgs[0], cmdAndArgs.slice(1), {stdio: 
(silent && (silent !== 2)) ? 'default' : 'inherit'});
     return result.then(null, function(e) {
         if (allowError) {
             return null;
-        } else if (!(silent === true)) {
+        } else if (+silent != 1) {
             print(e.output);
         }
         process.exit(2);

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/dc34ee98/src/repo-update.js
----------------------------------------------------------------------
diff --git a/src/repo-update.js b/src/repo-update.js
index 8ba3a9c..78b2bea 100644
--- a/src/repo-update.js
+++ b/src/repo-update.js
@@ -81,13 +81,18 @@ function *updateRepos(repos, branches, noFetch) {
     });
 
     if (!noFetch) {
+        var fetchPromises = [];
         yield repoutil.forEachRepo(repos, function*(repo) {
             if (repo.svn) {
                 return;
             }
             // Note: this does the same as git fetch --tags origin && git 
fetch origin
-            yield executil.execHelper(executil.ARGS('git remote update ', 
repo.remoteName));
+            fetchPromises.push(executil.execHelper(executil.ARGS('git remote 
update ', repo.remoteName), 3));
         });
+        if (fetchPromises.length > 1) {
+          print('Waiting for concurrent fetches to finish...');
+        }
+        yield fetchPromises;
     }
 
     if (branches && branches.length) {

Reply via email to