You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/06/20 06:08:32 UTC

[1/2] git commit: Fix up sometimes forgetting to git checkout (broke in prev commit)

Updated Branches:
  refs/heads/master 0e2b01996 -> f36d09d00


Fix up sometimes forgetting to git checkout (broke in prev commit)

Also emit a better message at the end for prepare-release-command.


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

Branch: refs/heads/master
Commit: 790d9d019035a169f8b04eefe936903bad2231ae
Parents: 0e2b019
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Jun 19 23:54:46 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Jun 19 23:54:46 2013 -0400

----------------------------------------------------------------------
 coho | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/790d9d01/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index af2a6c8..325c5f3 100755
--- a/coho
+++ b/coho
@@ -166,7 +166,18 @@ var repoGroups = {
 };
 
 var performGitPush = false;
-var needsGitPush = false;
+var gitPushCount = 0;
+
+function reportGitPushResult() {
+    console.log('');
+    if (gitPushCount && !performGitPush) {
+        console.log('All work complete. Changes were made locally. Run again with --push to push them.');
+    } else if (gitPushCount) {
+        console.log('All work complete. Changes were successfully pushed.');
+    } else {
+        console.log('All work complete. No changes were made.');
+    }
+}
 
 function fatal() {
     console.error.apply(console, arguments);
@@ -199,8 +210,8 @@ function logCwd() {
 
 function execHelper(cmd, silent, allowError) {
     if (/^git push/.exec(cmd)) {
+        gitPushCount++;
         if (!performGitPush) {
-            needsGitPush = true;
             return;
         }
     }
@@ -227,6 +238,13 @@ function cpAndLog(src, dest) {
     }
 }
 
+function gitCheckout(branchName) {
+    var curBranch = retrieveCurrentBranchName();
+    if (curBranch != branchName) {
+        execHelper('git checkout ' + branchName);
+    }
+}
+
 var isInForEachRepoFunction = false;
 
 function forEachRepo(repos, func) {
@@ -603,16 +621,12 @@ function updateRepos(repos, branches, noFetch) {
                 console.log('Repo already up-to-date: ' + repo.repoName);
             } else {
                 console.log('Updating ' + repo.repoName);
-                var curBranch = retrieveCurrentBranchName();
                 stashAndPop(repo, function() {
                     staleBranches.forEach(function(branchName) {
                         if (!remoteBranchExists(repo, branchName)) {
                             console.warning('Skipping branch. Remote branch "' + branchName + '" does not exist.');
                         } else {
-                            if (curBranch != branchName) {
-                                execHelper('git checkout ' + branchName);
-                                curBranch = branchName;
-                            }
+                            gitCheckout(branchName);
                             execHelper('git rebase ' + repo.remoteName + '/' + branchName);
                         }
                     });
@@ -717,6 +731,7 @@ function prepareReleaseBranchCommand() {
         stashAndPop(repo, function() {
             // git fetch + update master
             updateRepos([repo], ['master'], false);
+            gitCheckout('master');
             // Update JS on master.
             updateJsSnapshot(repo, version, 'master');
 
@@ -725,6 +740,7 @@ function prepareReleaseBranchCommand() {
                 console.log('Remote branch already exists for repo: ' + repo.repoName);
                 // Check out and rebase.
                 updateRepos([repo], [branchName], true);
+                gitCheckout(branchName);
                 // Update JS on branch.
                 updateJsSnapshot(repo, version, branchName);
             } else {
@@ -762,11 +778,7 @@ function prepareReleaseBranchCommand() {
         });
     });
 
-    console.log('');
-    console.log('All work is complete.');
-    if (needsGitPush) {
-        console.log('Run again with --push to push changes.');
-    }
+    reportGitPushResult();
 }
 
 function tagReleaseBranchCommand(argv) {
@@ -790,7 +802,7 @@ function tagReleaseBranchCommand(argv) {
 
             if (remoteBranchExists(repo, branchName)) {
                 console.log('Remote branch already exists for repo: ' + repo.repoName);
-                execHelper('git checkout ' + branchName);
+                gitCheckout(branchName);
             } else {
                 fatal('Release branch does not exist for repo ' + repo.repoName);
             }
@@ -814,11 +826,7 @@ function tagReleaseBranchCommand(argv) {
         });
     });
 
-    console.log('');
-    console.log('All work is complete.');
-    if (needsGitPush) {
-        console.log('Run again with --push to push changes.');
-    }
+    reportGitPushResult();
 }
 
 function ratCommand() {


[2/2] git commit: Simplify VERSION logic and added windows VERSION updating

Posted by ag...@apache.org.
Simplify VERSION logic and added windows VERSION updating


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

Branch: refs/heads/master
Commit: f36d09d0001a3835e6cd7eaaa736bea2169a2871
Parents: 790d9d0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jun 20 00:08:09 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jun 20 00:08:09 2013 -0400

----------------------------------------------------------------------
 coho | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/f36d09d0/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 325c5f3..0d6dfd2 100755
--- a/coho
+++ b/coho
@@ -54,17 +54,20 @@ var platformRepos = [
         title: 'iOS',
         id: 'ios',
         repoName: 'cordova-ios',
-        cordovaJsPaths: ['CordovaLib/cordova.js']
+        cordovaJsPaths: ['CordovaLib/cordova.js'],
+        versionFilePaths: [path.join('CordovaLib', 'VERSION')]
     }, {
         title: 'BlackBerry',
         id: 'blackberry',
-        repoName: 'cordova-blackberry'
+        repoName: 'cordova-blackberry',
+        versionFilePaths: [path.join('blackberry', 'VERSION'), path.join('blackberry10', 'VERSION')]
     }, {
         title: 'Windows',
         id: 'windows',
         repoName: 'cordova-windows',
         cordovaJsSrcName: 'cordova.windows8.js',
-        cordovaJsPaths: ['windows8/cordova.js', 'windows8/template/www/cordova.js']
+        cordovaJsPaths: ['windows8/cordova.js', 'windows8/template/www/cordova.js'],
+        versionFilePaths: [path.join('windows8', 'VERSION'), path.join('windows8', 'template', 'VERSION')]
     }, {
         title: 'Windows Phone 7',
         id: 'wp7',
@@ -748,19 +751,12 @@ function prepareReleaseBranchCommand() {
                 execHelper('git push --set-upstream ' + repo.remoteName + ' ' + branchName);
             }
             // Update the VERSION files.
-            var versionFilePath = 'VERSION';
-            if (repo.id == 'ios') {
-                versionFilePath = path.join('CordovaLib', 'VERSION');
-            } else if (repo.id == 'blackberry') {
-                versionFilePath = path.join('blackberry', 'VERSION');
-            }
-            if (fs.existsSync(versionFilePath)) {
+            var versionFilePaths = repo.versionFilePaths || ['VERSION'];
+            if (fs.existsSync(versionFilePaths[0])) {
                 console.log(repo.repoName + ': ' + 'Updating VERSION file.');
-                fs.writeFileSync(versionFilePath, version + '\n');
-                if (repo.id == 'blackberry') {
-                    versionFilePath = 'blackberry10/VERSION';
+                versionFilePaths.forEach(function(versionFilePath) {
                     fs.writeFileSync(versionFilePath, version + '\n');
-                }
+                });
                 if (repo.id == 'android') {
                     shjs.sed('-i', /cordovaVersion.*=.*;/, 'cordovaVersion = "' + version + '";', path.join('framework', 'src', 'org', 'apache', 'cordova', 'Device.java'));
                 }