diff --git a/components/git/release.js b/components/git/release.js index 79609f3c..7d092012 100644 --- a/components/git/release.js +++ b/components/git/release.js @@ -85,29 +85,6 @@ async function main(state, argv, cli, dir) { } } - // Check the branch diff to determine if the releaser - // wants to backport any more commits before proceeding. - cli.startSpinner('Fetching branch-diff'); - const raw = prep.getBranchDiff({ onlyNotableChanges: false }); - const diff = raw.split('*'); - cli.stopSpinner('Got branch diff'); - - const outstandingCommits = diff.length - 1; - if (outstandingCommits !== 0) { - const staging = `v${semver.major(prep.newVersion)}.x-staging`; - const proceed = await cli.prompt( - `There are ${outstandingCommits} commits that may be ` + - `backported to ${staging} - do you still want to proceed?`, - { defaultAnswer: false }); - - if (!proceed) { - const seeDiff = await cli.prompt( - 'Do you want to see the branch diff?'); - if (seeDiff) cli.log(raw); - return; - } - } - return prep.prepare(); } else if (state === PROMOTE) { // TODO(codebytere): implement release promotion. diff --git a/lib/prepare_release.js b/lib/prepare_release.js index 8be7bc2a..98d0b13a 100644 --- a/lib/prepare_release.js +++ b/lib/prepare_release.js @@ -55,6 +55,33 @@ class ReleasePreparation { async prepare() { const { cli, newVersion, versionComponents } = this; + // Check the branch diff to determine if the releaser + // wants to backport any more commits before proceeding. + cli.startSpinner('Fetching branch-diff'); + const raw = this.getBranchDiff({ + onlyNotableChanges: false, + comparisonBranch: newVersion + }); + + const diff = raw.split('*'); + cli.stopSpinner('Got branch diff'); + + const outstandingCommits = diff.length - 1; + if (outstandingCommits !== 0) { + const staging = `v${semver.major(prep.newVersion)}.x-staging`; + const proceed = await cli.prompt( + `There are ${outstandingCommits} commits that may be ` + + `backported to ${staging} - do you still want to proceed?`, + { defaultAnswer: false }); + + if (!proceed) { + const seeDiff = await cli.prompt( + 'Do you want to see the branch diff?'); + if (seeDiff) cli.log(raw); + return; + } + } + // Create new proposal branch. cli.startSpinner(`Creating new proposal branch for ${newVersion}`); await this.createProposalBranch();