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/09/17 17:11:29 UTC
[2/2] git commit: Tweak JS updating so that it updates the JS on
master / release branch separately.
Tweak JS updating so that it updates the JS on master / release branch separately.
Now that we version master branch with "-dev", it doesn't make sense to
branch after updating the JS.
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/b3f54d90
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/b3f54d90
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/b3f54d90
Branch: refs/heads/master
Commit: b3f54d909ddfa916f861c81c3696bfb319350c4a
Parents: 7584a56
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 17 10:42:54 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 17 11:10:35 2013 -0400
----------------------------------------------------------------------
coho | 41 ++++++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/b3f54d90/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index ff0d93c..aa9c6f6 100755
--- a/coho
+++ b/coho
@@ -350,6 +350,9 @@ function createPlatformDevVersion(version) {
}
function getVersionBranchName(version) {
+ if (/-dev$/.test(version)) {
+ return 'master';
+ }
return version.replace(/\d+(-?rc\d)?$/, 'x');
}
@@ -418,9 +421,9 @@ function cpAndLog(src, dest) {
}
function gitCheckout(branchName) {
- var curBranch = retrieveCurrentBranchName();
+ var curBranch = retrieveCurrentBranchName(true);
if (curBranch != branchName) {
- execHelper('git checkout ' + branchName);
+ execHelper('git checkout -q ' + branchName);
}
}
@@ -661,9 +664,12 @@ function remoteBranchExists(repo, name) {
return !!execHelper('git branch -r --list ' + repo.remoteName + '/' + name, true);
}
-function retrieveCurrentBranchName() {
+function retrieveCurrentBranchName(allowDetached) {
var ref = execHelper('git symbolic-ref HEAD', true, true);
if (!ref) {
+ if (allowDetached) {
+ return null;
+ }
throw new Error('Aborted due to repo ' + shjs.pwd() + ' not being on a named branch');
}
var match = /refs\/heads\/(.*)/.exec(ref);
@@ -1086,20 +1092,22 @@ function configureReleaseCommandFlags(opt) {
return argv;
}
-var hasBuiltJs = false;
+var hasBuiltJs = '';
function updateJsSnapshot(repo, version) {
function ensureJsIsBuilt() {
var cordovaJsRepo = getRepoById('js');
- if (!hasBuiltJs) {
+ if (hasBuiltJs != version) {
forEachRepo([cordovaJsRepo], function() {
- gitCheckout(getVersionBranchName(version));
- var actualCurTag = retrieveCurrentTagName();
- if (actualCurTag != version) {
- fatal('Not preparing branches since cordova-js is not at the version tag. (it\'s at ' + actualCurTag + ')');
- }
- execHelper('grunt cordovajs');
- hasBuiltJs = true;
+ stashAndPop(cordovaJsRepo, function() {
+ if (getVersionBranchName(version) == 'master') {
+ gitCheckout('master');
+ } else {
+ gitCheckout(version);
+ }
+ execHelper('grunt cordovajs');
+ hasBuiltJs = version;
+ });
});
}
}
@@ -1186,9 +1194,6 @@ function prepareReleaseBranchCommand() {
stashAndPop(repo, function() {
// git fetch + update master
updateRepos([repo], ['master'], false);
- gitCheckout('master');
- // Update JS on master.
- updateJsSnapshot(repo, version);
// Either create or pull down the branch.
if (remoteBranchExists(repo, branchName)) {
@@ -1196,19 +1201,21 @@ function prepareReleaseBranchCommand() {
// Check out and rebase.
updateRepos([repo], [branchName], true);
gitCheckout(branchName);
- // Update JS on branch.
- updateJsSnapshot(repo, version);
} else if (localBranchExists(branchName)) {
execHelper('git checkout ' + branchName);
} else {
+ gitCheckout('master');
execHelper('git checkout -b ' + branchName);
}
+ updateJsSnapshot(repo, version);
print(repo.repoName + ': ' + 'Setting VERSION to "' + version + '" on branch + "' + branchName + '".');
updateRepoVersion(repo, version);
+
gitCheckout('master');
var devVersion = createPlatformDevVersion(version);
print(repo.repoName + ': ' + 'Setting VERSION to "' + devVersion + '" on branch + "master".');
updateRepoVersion(repo, devVersion);
+ updateJsSnapshot(repo, devVersion);
gitCheckout(branchName);
});
});