Skip to content

Commit eec2250

Browse files
committed
Move initial branchDiff to prepare
1 parent c0693d7 commit eec2250

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

components/git/release.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,6 @@ async function main(state, argv, cli, dir) {
8585
}
8686
}
8787

88-
// Check the branch diff to determine if the releaser
89-
// wants to backport any more commits before proceeding.
90-
cli.startSpinner('Fetching branch-diff');
91-
const raw = prep.getBranchDiff({ onlyNotableChanges: false });
92-
const diff = raw.split('*');
93-
cli.stopSpinner('Got branch diff');
94-
95-
const outstandingCommits = diff.length - 1;
96-
if (outstandingCommits !== 0) {
97-
const staging = `v${semver.major(prep.newVersion)}.x-staging`;
98-
const proceed = await cli.prompt(
99-
`There are ${outstandingCommits} commits that may be ` +
100-
`backported to ${staging} - do you still want to proceed?`,
101-
{ defaultAnswer: false });
102-
103-
if (!proceed) {
104-
const seeDiff = await cli.prompt(
105-
'Do you want to see the branch diff?');
106-
if (seeDiff) cli.log(raw);
107-
return;
108-
}
109-
}
110-
11188
return prep.prepare();
11289
} else if (state === PROMOTE) {
11390
// TODO(codebytere): implement release promotion.

lib/prepare_release.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,33 @@ class ReleasePreparation {
5555
async prepare() {
5656
const { cli, newVersion, versionComponents } = this;
5757

58+
// Check the branch diff to determine if the releaser
59+
// wants to backport any more commits before proceeding.
60+
cli.startSpinner('Fetching branch-diff');
61+
const raw = this.getBranchDiff({
62+
onlyNotableChanges: false,
63+
comparisonBranch: newVersion
64+
});
65+
66+
const diff = raw.split('*');
67+
cli.stopSpinner('Got branch diff');
68+
69+
const outstandingCommits = diff.length - 1;
70+
if (outstandingCommits !== 0) {
71+
const staging = `v${semver.major(prep.newVersion)}.x-staging`;
72+
const proceed = await cli.prompt(
73+
`There are ${outstandingCommits} commits that may be ` +
74+
`backported to ${staging} - do you still want to proceed?`,
75+
{ defaultAnswer: false });
76+
77+
if (!proceed) {
78+
const seeDiff = await cli.prompt(
79+
'Do you want to see the branch diff?');
80+
if (seeDiff) cli.log(raw);
81+
return;
82+
}
83+
}
84+
5885
// Create new proposal branch.
5986
cli.startSpinner(`Creating new proposal branch for ${newVersion}`);
6087
await this.createProposalBranch();

0 commit comments

Comments
 (0)