cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-lib git commit: CB-8634 Adds support for custom branches for `cordova platform add`
Date Wed, 11 Mar 2015 10:28:44 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master f830e4651 -> 4d2059452


CB-8634 Adds support for custom branches for `cordova platform add`

This closes #180


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

Branch: refs/heads/master
Commit: 4d2059452fa36dd510d9a949e150de840d336e04
Parents: f830e46
Author: Omar Mefire <ommenjik@microsoft.com>
Authored: Sun Mar 8 15:53:38 2015 -0700
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Wed Mar 11 13:28:31 2015 +0300

----------------------------------------------------------------------
 cordova-lib/src/cordova/lazy_load.js | 5 +++--
 cordova-lib/src/cordova/platform.js  | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4d205945/cordova-lib/src/cordova/lazy_load.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/lazy_load.js b/cordova-lib/src/cordova/lazy_load.js
index 5c558ee..bd97805 100644
--- a/cordova-lib/src/cordova/lazy_load.js
+++ b/cordova-lib/src/cordova/lazy_load.js
@@ -283,7 +283,7 @@ function custom(platforms, platform) {
 }
 
 // Returns a promise
-function git_clone_platform(git_url) {
+function git_clone_platform(git_url, branch) {
     // Create a tmp dir. Using /tmp is a problem because it's often on a different partition
and sehll.mv()
     // fails in this case with "EXDEV, cross-device link not permitted".
     var tmp_subidr = 'tmp_cordova_git_' + process.pid + '_' + (new Date()).valueOf();
@@ -295,7 +295,8 @@ function git_clone_platform(git_url) {
         repository: git_url,
         location: tmp_dir
     }).then(function () {
-        return gitclone.clone(git_url, 'master', tmp_dir);
+        var branchToCheckout = branch || 'master';
+        return gitclone.clone(git_url, branchToCheckout, tmp_dir);
     }).then(function () {
         HooksRunner.fire('after_platform_clone', {
             repository: git_url,

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4d205945/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 1e2adac..a1a0234 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -211,7 +211,10 @@ function downloadPlatform(projectRoot, platform, version, opts) {
     return Q().then(function() {
         if (cordova_util.isUrl(version)) {
             events.emit('log', 'git cloning: ' + version);
-            return lazy_load.git_clone(version).fail(function(err){
+            var parts = version.split('#');
+            var git_url = parts[0];
+            var branchToCheckout = parts[1];
+            return lazy_load.git_clone(git_url, branchToCheckout){
                 // If it looks like a url, but cannot be cloned, try handling it differently.
                 // it's because it's a tarball of the form: 
                 //     - wp8@https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git;a=snapshot;h=3.7.0;sf=tgz


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


Mime
View raw message