Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7B79A200C14 for ; Tue, 7 Feb 2017 23:28:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 79ECC160B3E; Tue, 7 Feb 2017 22:28:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 746A2160B32 for ; Tue, 7 Feb 2017 23:28:00 +0100 (CET) Received: (qmail 95282 invoked by uid 500); 7 Feb 2017 22:27:59 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 95273 invoked by uid 99); 7 Feb 2017 22:27:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2017 22:27:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8E87BDFBDB; Tue, 7 Feb 2017 22:27:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: commits@cordova.apache.org Message-Id: <81c95673095b447fabb9f4727d2109c1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-coho git commit: working towards verification of changes before pushing to remotes. Date: Tue, 7 Feb 2017 22:27:59 +0000 (UTC) archived-at: Tue, 07 Feb 2017 22:28:01 -0000 Repository: cordova-coho Updated Branches: refs/heads/plugins-releaser 82a347127 -> 2eb3f1740 working towards verification of changes before pushing to remotes. Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/2eb3f174 Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/2eb3f174 Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/2eb3f174 Branch: refs/heads/plugins-releaser Commit: 2eb3f17400428712b4f42c013ce474815258e3ca Parents: 82a3471 Author: filmaj Authored: Tue Feb 7 14:27:46 2017 -0800 Committer: filmaj Committed: Tue Feb 7 14:27:46 2017 -0800 ---------------------------------------------------------------------- src/gitutil.js | 13 ++++++++-- src/plugin-release.js | 60 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 61 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/2eb3f174/src/gitutil.js ---------------------------------------------------------------------- diff --git a/src/gitutil.js b/src/gitutil.js index dcc7fcd..ad2da3d 100644 --- a/src/gitutil.js +++ b/src/gitutil.js @@ -163,11 +163,11 @@ exports.gitClean = function() { return executil.execHelper(executil.ARGS('git clean -d -f'), false, true); } -exports.summaryOfChanges = function(base_sha) { +exports.summaryOfChanges = function*(base_sha) { var cmd = executil.ARGS('git log --topo-order --no-merges'); cmd.push(['--pretty=format:* %s']); cmd.push(base_sha + '..master'); - return executil.execHelper(cmd, true, false); + return yield executil.execHelper(cmd, true, false); } exports.commitChanges = function*(commit_msg) { @@ -177,3 +177,12 @@ exports.commitChanges = function*(commit_msg) { exports.tagRepo = function*(version) { return yield executil.execHelper(executil.ARGS('git tag', version)); } + +exports.pushToOrigin = function*(ref) { + // TODO TEST: uncomment once ready to test + //return yield executil.execHelper(executil.ARGS('git push origin', ref)); +} + +exports.diff = function(first, second) { + return executil.execHelper(executil.ARGS('git diff', first + '..' + second)); +} http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/2eb3f174/src/plugin-release.js ---------------------------------------------------------------------- diff --git a/src/plugin-release.js b/src/plugin-release.js index e14ead9..26f4c65 100644 --- a/src/plugin-release.js +++ b/src/plugin-release.js @@ -231,7 +231,8 @@ function *interactive_plugins_release() { plugin_data[repo.repoName] = { last_release: last_release }; - var changes = (yield gitutil.summaryOfChanges(last_release)).split('\n').filter(function(line) { + var changes = yield gitutil.summaryOfChanges(last_release); + changes = changes.split('\n').filter(function(line) { return (line.toLowerCase().indexOf('incremented plugin version') == -1); }); if (changes.length > 0) { @@ -310,7 +311,8 @@ function *interactive_plugins_release() { console.log('No license issues found - continuing.'); } }).then(function() { - //TODO: + // TODO: step 8 apparently is "rarely" done based on fil's experience running through the plugin release steps manually. + // soooo.... what do? /* 8. ensure all dependencies and subdependencies have apache-compatible licenses. * 9. update plugin versions + release notes. * - for each plugin, remove the `-dev` suffix in plugin.xml, package.json, and plugin.xml of `tests/` subdirectory (if exists)*/ @@ -371,7 +373,8 @@ function *interactive_plugins_release() { yield repoutil.forEachRepo(plugin_repos, function*(repo) { var plugin_name = repo.repoName; if (plugin_data[plugin_name].current_release != release_notes[plugin_name + '-version']) { - // Overwrite plugin version if, after release notes review, RM decided on a different version. + // If, after release notes review, RM decided on a different version... + // Overwrite plugin version var previous_assumed_version = plugin_data[plugin_name].current_release; plugin_data[plugin_name].current_release = release_notes[plugin_name + '-version']; yield versionutil.updateRepoVersion(repo, plugin_data[plugin_name].current_release, {commitChanges:false}); @@ -385,7 +388,8 @@ function *interactive_plugins_release() { * - tag each plugin repo with $v*/ if (yield gitutil.pendingChangesExist()) { yield gitutil.commitChanges(plugins_release_issue.key + ' Updated version and RELEASENOTES.md for release ' + plugin_data[plugin_name].current_release); - yield gitutil.tagRepo(plugin_data[plugin_name].current_release); + // TODO TEST: uncomment once ready to rock + //yield gitutil.tagRepo(plugin_data[plugin_name].current_release); } else { console.warn('No pending changes detected for ' + plugin_name + '; that\'s probably not good eh?'); } @@ -401,28 +405,31 @@ function *interactive_plugins_release() { var release_branch_name = versionutil.getReleaseBranchNameFromVersion(plugin_version); if (yield gitutil.remoteBranchExists(repo, release_branch_name)) { repos_with_existing_release_branch.push(repo); + // also store HEAD of release branch, so later on we can show a diff of the branch before pushing + plugin_data[plugin_name].release_branch_head = gitutil.hashForRef(release_branch_name); } else { yield gitutil.createNewBranch(release_branch_name); console.log('Created branch', release_branch_name, 'in repo', plugin_name); } }); + return repos_with_existing_release_branch; })(); }).then(function(repos_with_existing_release_branch) { // Here we are passed an array of repos that already had release branches created prior to starting the release process. - // Our mission in this clause, should we choose to accept it, is to merge master back into the branch. But, this can be dangerous! + // Our mission in this clause, should we choose to accept it, is to merge master back into the branch. But, this can be dangerous! // TODO: Should we ask the user to handle the merge / cherry pick, then? Or should we merge automatically? // This section, right now, simply tells the user to handle the merge manually in a seperate shell. // IF THEY FAIL TO DO THIS, then we will seriously fuck shit up by pushing release branches up (done in next promise section). :/ console.warn('Some release branches already exist!'); - console.warn('You will need to handle these repos manually!'); + console.warn('You will need to manually cherry-pick or merge from master into the release branch for these repos manually!'); var prompts = []; - repos_with_existing_branch_name.forEach(function(repo) { + repos_with_existing_release_branch.forEach(function(repo) { var plugin_name = repo.repoName; var rb = versionutil.getReleaseBranchFromVersion(plugin_data[plugin_name].current_version) prompts.push({ type: 'confirm', name: 'rb_proceed_' + plugin_name, - message: plugin_name + ' already has an existing release branch ' + rb + '. You will need to manually merge or cherry-pick the master branch into the ' + rb + ' branch. Once you have done this (probably in a separate shell or command prompt), hit Enter to continue.' + message: plugin_name + ' already has an existing release branch "' + rb + '". You will need to manually merge or cherry-pick the master branch into the "' + rb + '" branch. Once you have done this (probably in a separate shell or command prompt), hit Enter to continue.' }); }); return inquirer.prompt(prompts); @@ -435,17 +442,50 @@ function *interactive_plugins_release() { var newest_version = plugin_data[plugin_name].current_release + '-dev'; console.log('Checking out master branch of', plugin_name, 'and setting version to', newest_version, ', then committing that change to master branch...'); yield gitutil.gitCheckout('master'); + // store previous master HEAD, for later comparison/showing of diff + plugin_data[plugin_name].previous_master_head = gitutil.hashForRef('master'); yield versionutil.updateRepoVersion(repo, newest_version, {commitChanges:true}); }); })(); + }).then(function() { + /* 12. Push tags, release branch, and master branch changes. + * start with tag */ + return co.wrap(function *() { + var master_prompts = []; + yield repoutil.forEachRepo(plugin_repos, function*(repo) { + var plugin_name = repo.repoName; + var tag = plugin_data[plugin_name].current_release; + console.log(plugin_name, ': pushing tag "', tag, '"'); + yield gitutil.pushToOrigin(tag); + // compile master diff for confirmation in next promise section + var diff = gitutil.diff(plugin_data[plugin_name].previous_master_head, 'master'); + master_prompts.push({ + type: 'confirm', + name: 'master_' + plugin_name, + message: 'About to push the following changes to the master branch of ' + plugin_name + ': ' + diff + '\nDo you wish to continue?' + }); + }); + return master_prompts; + })(); + }).then(function(master_prompts) { + /* - show diff of last master commit, confirm, push, git push origin master*/ + }).then(function() { + /* - show diff of release branch: + * - if release branch did not exist before, show diff (simple, just branch..master), confirm, then push + * - if release branch did exist before, show diff (branch HEAD..last branch commit), confirm, then push*/ + var previous_release_branch_head = plugin_data[plugin_name].release_branch_head; + if (previous_release_branch_head) { + // release branch previously existed. + } else { + // release branch did NOT exist previously, this is a new release branch. + } }); }, function(auth_err) { var keys = Object.keys(auth_err); console.error('ERROR! There was a problem connecting to JIRA, received a', auth_err.statusCode, 'status code.'); process.exit(1); }); - /* 12. Push tags, release branch, and master branch changes. - * 13. Publish to apache svn: + /* 13. Publish to apache svn: * - repo-clone the dist and dist/dev svn repos * - create-archive -r $ACTIVE --dest cordova-dist-dev/$JIRA * - "manually double check version numbers are correct on the file names" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org