cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgreb...@apache.org
Subject [1/2] git commit: Add --depth option for repo-clone
Date Thu, 16 Oct 2014 09:54:33 GMT
Repository: cordova-coho
Updated Branches:
  refs/heads/master 4b1833f21 -> 9c63ceba8


Add --depth option for repo-clone


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

Branch: refs/heads/master
Commit: a2b6a66bb09cda6c161a044d07b4bd0aca557da0
Parents: 365c4aa
Author: Evgeny Agafonchikov <evgeny.agafonchikov@akvelon.com>
Authored: Tue Oct 14 14:21:52 2014 +0400
Committer: Evgeny Agafonchikov <evgeny.agafonchikov@akvelon.com>
Committed: Tue Oct 14 14:21:52 2014 +0400

----------------------------------------------------------------------
 src/flagutil.js    |  6 ++++++
 src/repo-clone.js  | 11 ++++++++---
 src/repo-update.js |  6 +++++-
 3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/a2b6a66b/src/flagutil.js
----------------------------------------------------------------------
diff --git a/src/flagutil.js b/src/flagutil.js
index 2c9e4b2..85512f7 100644
--- a/src/flagutil.js
+++ b/src/flagutil.js
@@ -35,6 +35,12 @@ exports.registerRepoFlag = function(opt) {
     });
 }
 
+exports.registerDepthFlag = function(opt) {
+    return opt.options('depth', {
+        desc: 'Value of --depth flag for git repos.'
+    });
+}
+
 exports.computeReposFromFlag = function(flagValue) {
     var values = flagValue === true ? [] : Array.isArray(flagValue) ? flagValue : [flagValue];
     var ret = [];

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/a2b6a66b/src/repo-clone.js
----------------------------------------------------------------------
diff --git a/src/repo-clone.js b/src/repo-clone.js
index 1086135..51fe596 100644
--- a/src/repo-clone.js
+++ b/src/repo-clone.js
@@ -27,6 +27,7 @@ var print = apputil.print;
 module.exports = function*(argv) {
     var opt = flagutil.registerRepoFlag(optimist)
     opt = flagutil.registerHelpFlag(opt);
+    opt = flagutil.registerDepthFlag(opt);
     var argv = opt
         .usage('Clones git repositories into the current working directory. If the repositories
are already cloned, then this is a no-op.\n\n' +
                'Usage: $0 clone --repo=name [--repo=othername]')
@@ -36,15 +37,18 @@ module.exports = function*(argv) {
         optimist.showHelp();
         process.exit(1);
     }
+
+    var depth = argv.depth ? argv.depth : null;
+
     var repos = flagutil.computeReposFromFlag(argv.r);
-    yield cloneRepos(repos, false);
+    yield cloneRepos(repos, false, depth);
 }
 
 function createRepoUrl(repo) {
     return 'https://git-wip-us.apache.org/repos/asf/' + repo.repoName + '.git';
 }
 
-function *cloneRepos(repos, quiet) {
+function *cloneRepos(repos, quiet, depth) {
     var failures = [];
     var numSkipped = 0;
 
@@ -57,7 +61,8 @@ function *cloneRepos(repos, quiet) {
         } else if (repo.svn) {
             clonePromises.push(executil.execHelper(executil.ARGS('svn checkout ' + repo.svn
+ ' ' + repo.repoName)));
         } else {
-            clonePromises.push(executil.execHelper(executil.ARGS('git clone ' + createRepoUrl(repo))));
+            var depthArg = depth == null ? '' : '--depth ' + depth + ' ';
+            clonePromises.push(executil.execHelper(executil.ARGS('git clone ' + depthArg
+ createRepoUrl(repo))));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/a2b6a66b/src/repo-update.js
----------------------------------------------------------------------
diff --git a/src/repo-update.js b/src/repo-update.js
index 4e08a36..6d56ef7 100644
--- a/src/repo-update.js
+++ b/src/repo-update.js
@@ -27,6 +27,7 @@ var print = apputil.print;
 
 module.exports = function*(argv) {
     var opt = flagutil.registerRepoFlag(optimist)
+    opt = flagutil.registerDepthFlag(opt);
     var opt = opt
         .options('b', {
             alias: 'branch',
@@ -58,6 +59,9 @@ module.exports = function*(argv) {
         optimist.showHelp();
         process.exit(1);
     }
+
+    var depth = argv.depth ? argv.depth : null;
+
     var branches = Array.isArray(argv.b) ? argv.b : [argv.b];
     var repos = flagutil.computeReposFromFlag(argv.r);
     apputil.prefixLength = Math.max.apply(null,
@@ -66,7 +70,7 @@ module.exports = function*(argv) {
         );
 
     // ensure that any missing repos are cloned
-    yield require('./repo-clone').cloneRepos(repos,true);
+    yield require('./repo-clone').cloneRepos(repos,true,depth);
     yield updateRepos(repos, branches, !argv.fetch);
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message