cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] git commit: Clone repos concurrently (faster)
Date Wed, 04 Jun 2014 01:38:20 GMT
Clone repos concurrently (faster)


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

Branch: refs/heads/master
Commit: 72a982196fb29a17fbcfd74ba07106813790565c
Parents: dc34ee9
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Jun 3 21:37:58 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Jun 3 21:37:58 2014 -0400

----------------------------------------------------------------------
 src/repo-clone.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/72a98219/src/repo-clone.js
----------------------------------------------------------------------
diff --git a/src/repo-clone.js b/src/repo-clone.js
index a0936dd..1086135 100644
--- a/src/repo-clone.js
+++ b/src/repo-clone.js
@@ -48,18 +48,24 @@ function *cloneRepos(repos, quiet) {
     var failures = [];
     var numSkipped = 0;
 
+    var clonePromises = [];
     for (var i = 0; i < repos.length; ++i) {
         var repo = repos[i];
         if (fs.existsSync(repo.repoName)) {
             if(!quiet) print('Repo already cloned: ' + repo.repoName);
             numSkipped +=1 ;
         } else if (repo.svn) {
-            yield executil.execHelper(executil.ARGS('svn checkout ' + repo.svn + ' ' + repo.repoName));
+            clonePromises.push(executil.execHelper(executil.ARGS('svn checkout ' + repo.svn
+ ' ' + repo.repoName)));
         } else {
-            yield executil.execHelper(executil.ARGS('git clone --progress ' + createRepoUrl(repo)));
+            clonePromises.push(executil.execHelper(executil.ARGS('git clone ' + createRepoUrl(repo))));
         }
     }
 
+    if (clonePromises.length > 1) {
+        print('Waiting for clones to finish...');
+    }
+    yield clonePromises;
+
     var numCloned = repos.length - numSkipped;
     if (numCloned) {
         print('Successfully cloned ' + numCloned + ' repositories.');


Mime
View raw message