cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject [1/4] git commit: [CB-7744] Add support for git-depth flag to coho clone
Date Thu, 09 Oct 2014 14:08:25 GMT
Repository: cordova-coho
Updated Branches:
  refs/heads/CB-7744 [created] 92223bbc8


[CB-7744] Add support for git-depth flag to coho 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/d464771b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/d464771b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/d464771b

Branch: refs/heads/CB-7744
Commit: d464771baab49d506dd5b697339854db81b26240
Parents: 365c4aa
Author: maria.bukharina <maria.bukharina@akvelon.com>
Authored: Thu Oct 9 15:58:57 2014 +0400
Committer: maria.bukharina <maria.bukharina@akvelon.com>
Committed: Thu Oct 9 15:58:57 2014 +0400

----------------------------------------------------------------------
 src/flagutil.js    |  7 +++++++
 src/repo-clone.js  | 15 ++++++++++++---
 src/repo-update.js |  7 ++++++-
 3 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/d464771b/src/flagutil.js
----------------------------------------------------------------------
diff --git a/src/flagutil.js b/src/flagutil.js
index 2c9e4b2..4e24a4d 100644
--- a/src/flagutil.js
+++ b/src/flagutil.js
@@ -35,6 +35,13 @@ exports.registerRepoFlag = function(opt) {
     });
 }
 
+exports.registerDepthFlag = function(opt) {
+	return opt.options('d', {
+		alias: '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/d464771b/src/repo-clone.js
----------------------------------------------------------------------
diff --git a/src/repo-clone.js b/src/repo-clone.js
index 1086135..a052c11 100644
--- a/src/repo-clone.js
+++ b/src/repo-clone.js
@@ -36,15 +36,20 @@ module.exports = function*(argv) {
         optimist.showHelp();
         process.exit(1);
     }
+
+	var depth = null;
+	if(argv.d) {
+		depth = argv.d;
+	}
     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 +62,11 @@ 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))));
+			if(depth != null) {
+				clonePromises.push(executil.execHelper(executil.ARGS('git clone --depth ' + depth + '
' + createRepoUrl(repo))));
+			} else {
+				clonePromises.push(executil.execHelper(executil.ARGS('git clone ' + createRepoUrl(repo))));
+			}
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/d464771b/src/repo-update.js
----------------------------------------------------------------------
diff --git a/src/repo-update.js b/src/repo-update.js
index 4e08a36..32c4b22 100644
--- a/src/repo-update.js
+++ b/src/repo-update.js
@@ -58,6 +58,11 @@ module.exports = function*(argv) {
         optimist.showHelp();
         process.exit(1);
     }
+
+	var depth = null;
+	if(argv.d) {
+		depth = argv.d;
+	}
     var branches = Array.isArray(argv.b) ? argv.b : [argv.b];
     var repos = flagutil.computeReposFromFlag(argv.r);
     apputil.prefixLength = Math.max.apply(null,
@@ -66,7 +71,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