backport 6.0.0 → 6.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +179 -52
  2. package/dist/entrypoint.cli.js +2 -0
  3. package/dist/entrypoint.module.d.ts +16 -4
  4. package/dist/entrypoint.module.js +41 -13
  5. package/dist/entrypoint.module.private.test.d.ts +1 -0
  6. package/dist/entrypoint.module.private.test.js +34 -0
  7. package/dist/main.js +1 -2
  8. package/dist/options/ConfigOptions.d.ts +16 -6
  9. package/dist/options/cliArgs.d.ts +36 -37
  10. package/dist/options/cliArgs.js +25 -24
  11. package/dist/options/cliArgs.test.js +6 -10
  12. package/dist/options/config/config.d.ts +28 -52
  13. package/dist/options/config/config.js +2 -36
  14. package/dist/options/config/config.test.js +10 -27
  15. package/dist/options/config/getOptionsFromGit.d.ts +3 -2
  16. package/dist/options/config/getOptionsFromGit.js +1 -3
  17. package/dist/options/config/globalConfig.js +2 -5
  18. package/dist/options/config/globalConfig.test.js +0 -2
  19. package/dist/options/config/projectConfig.test.js +51 -14
  20. package/dist/options/config/readConfigFile.d.ts +52 -0
  21. package/dist/options/config/readConfigFile.js +28 -2
  22. package/dist/options/options.d.ts +55 -32
  23. package/dist/options/options.js +101 -7
  24. package/dist/options/options.test.js +248 -97
  25. package/dist/options/parseRequiredOptions.d.ts +3 -3
  26. package/dist/options/parseRequiredOptions.js +2 -4
  27. package/dist/options/parseRequiredOptions.test.js +6 -11
  28. package/dist/runSequentially.test.js +40 -78
  29. package/dist/services/git.d.ts +5 -2
  30. package/dist/services/git.js +11 -10
  31. package/dist/services/git.test.js +12 -9
  32. package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
  33. package/dist/services/github/v3/addAssigneesToPullRequest.js +2 -3
  34. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +4 -5
  35. package/dist/services/github/v3/createPullRequest.js +10 -13
  36. package/dist/services/github/v3/createPullRequest.test.d.ts +1 -0
  37. package/dist/services/github/v3/createPullRequest.test.js +110 -0
  38. package/dist/services/github/v3/createStatusComment.js +12 -14
  39. package/dist/services/github/v3/createStatusComment.test.js +58 -29
  40. package/dist/services/github/v4/apiRequestV4.d.ts +1 -1
  41. package/dist/services/github/v4/apiRequestV4.js +1 -1
  42. package/dist/services/github/v4/enablePullRequestAutoMerge.js +1 -1
  43. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -1
  44. package/dist/services/github/v4/fetchAuthorId.d.ts +5 -2
  45. package/dist/services/github/v4/fetchAuthorId.js +5 -6
  46. package/dist/services/github/v4/fetchAuthorId.private.test.js +3 -6
  47. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +8 -1
  48. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +1 -1
  49. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +6 -3
  50. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +8 -1
  51. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +1 -1
  52. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +3 -3
  53. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +12 -1
  54. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +6 -8
  55. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +10 -12
  56. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +5 -7
  57. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +3 -0
  58. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +55 -0
  59. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +5 -5
  60. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +2 -6
  61. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -2
  62. package/dist/services/github/v4/fetchProjectConfig.d.ts +8 -0
  63. package/dist/services/github/v4/fetchProjectConfig.js +56 -0
  64. package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +1 -0
  65. package/dist/services/github/v4/fetchProjectConfig.private.test.js +52 -0
  66. package/dist/services/github/v4/fetchProjectConfig.test.d.ts +1 -0
  67. package/dist/services/github/v4/fetchProjectConfig.test.js +37 -0
  68. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +67 -0
  69. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +130 -0
  70. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
  71. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +130 -0
  72. package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +3 -1
  73. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +22 -1
  74. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +4 -1
  75. package/dist/services/github/v4/getOptionsFromGithub/query.js +3 -0
  76. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +32 -15
  77. package/dist/services/sourceCommit/parseSourceCommit.d.ts +5 -1
  78. package/dist/services/sourceCommit/parseSourceCommit.js +2 -2
  79. package/dist/services/sourceCommit/parseSourceCommit.test.js +120 -5
  80. package/dist/test/inquirer.private.test.js +33 -36
  81. package/dist/test/integration/integration.private.test.js +114 -95
  82. package/dist/test/mockConfigFiles.d.ts +5 -0
  83. package/dist/test/mockConfigFiles.js +37 -0
  84. package/dist/test/nockHelpers.d.ts +1 -1
  85. package/dist/test/nockHelpers.js +4 -4
  86. package/dist/test/private/getDevAccessToken.js +1 -1
  87. package/dist/test/setupFiles/automatic-mocks.js +1 -29
  88. package/dist/ui/cherrypickAndCreatePullRequest.test.js +80 -28
  89. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -9
  90. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +13 -48
  91. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +222 -260
  92. package/dist/ui/getCommits.d.ts +1 -1
  93. package/dist/ui/getCommitsWithoutBackports.d.ts +11 -0
  94. package/dist/ui/getCommitsWithoutBackports.js +53 -0
  95. package/dist/ui/getCommitsWithoutBackports.test.d.ts +1 -0
  96. package/dist/ui/getCommitsWithoutBackports.test.js +259 -0
  97. package/dist/ui/getTargetBranches.d.ts +2 -1
  98. package/dist/ui/getTargetBranches.js +17 -1
  99. package/dist/ui/maybeSetupRepo.js +4 -3
  100. package/dist/ui/maybeSetupRepo.test.js +49 -3
  101. package/dist/utils/excludeUndefined.d.ts +6 -0
  102. package/dist/utils/excludeUndefined.js +7 -0
  103. package/dist/utils/excludeUndefined.test.d.ts +1 -0
  104. package/dist/utils/excludeUndefined.test.js +24 -0
  105. package/package.json +9 -8
  106. package/yarn.lock +98 -77
@@ -60,11 +60,12 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
60
60
  });
61
61
  describe('when commit has a pull request reference', () => {
62
62
  let res;
63
+ let createPullRequestCalls;
63
64
  beforeEach(async () => {
64
65
  const options = {
65
66
  assignees: [],
67
+ authenticatedUsername: 'sqren_authenticated',
66
68
  fork: true,
67
- githubApiBaseUrlV3: 'https://api.github.com',
68
69
  prDescription: 'myPrSuffix',
69
70
  prTitle: '[{targetBranch}] {commitMessages}',
70
71
  repoName: 'kibana',
@@ -73,7 +74,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
73
74
  sourceBranch: 'myDefaultSourceBranch',
74
75
  sourcePRLabels: [],
75
76
  targetPRLabels: ['backport'],
76
- username: 'sqren',
77
+ author: 'sqren',
77
78
  };
78
79
  const commits = [
79
80
  {
@@ -94,13 +95,9 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
94
95
  },
95
96
  ];
96
97
  const scope = (0, nock_1.default)('https://api.github.com')
97
- .post('/repos/elastic/kibana/pulls', {
98
- title: '[6.x] My original commit message (#1000) | My other commit message (#2000)',
99
- head: 'sqren:backport/6.x/pr-1000_pr-2000',
100
- base: '6.x',
101
- body: 'Backports the following commits to 6.x:\n - #1000\n - #2000\n\nmyPrSuffix',
102
- })
98
+ .post('/repos/elastic/kibana/pulls')
103
99
  .reply(200, { number: 1337, html_url: 'myHtmlUrl' });
100
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
104
101
  res = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
105
102
  options,
106
103
  commits,
@@ -109,6 +106,27 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
109
106
  scope.done();
110
107
  nock_1.default.cleanAll();
111
108
  });
109
+ it('creates the pull request with multiple PR references', () => {
110
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
111
+ Array [
112
+ Object {
113
+ "base": "6.x",
114
+ "body": "# Backport
115
+
116
+ This is an automatic backport to 6.x of:
117
+ - #1000
118
+ - #2000
119
+
120
+ ### Questions ?
121
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
122
+
123
+ myPrSuffix",
124
+ "head": "sqren_authenticated:backport/6.x/pr-1000_pr-2000",
125
+ "title": "[6.x] My original commit message (#1000) | My other commit message (#2000)",
126
+ },
127
+ ]
128
+ `);
129
+ });
112
130
  it('returns the expected response', () => {
113
131
  expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
114
132
  });
@@ -130,7 +148,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
130
148
  "Pulling latest changes",
131
149
  "Cherry-picking: My original commit message (#1000)",
132
150
  "Cherry-picking: My other commit message (#2000)",
133
- "Pushing branch \\"sqren:backport/6.x/pr-1000_pr-2000\\"",
151
+ "Pushing branch \\"sqren_authenticated:backport/6.x/pr-1000_pr-2000\\"",
134
152
  undefined,
135
153
  "Creating pull request",
136
154
  "Adding labels: backport",
@@ -140,18 +158,19 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
140
158
  });
141
159
  describe('when commit does not have a pull request reference', () => {
142
160
  let res;
161
+ let createPullRequestCalls;
143
162
  beforeEach(async () => {
144
163
  const options = {
145
164
  assignees: [],
165
+ authenticatedUsername: 'sqren_authenticated',
146
166
  fork: true,
147
- githubApiBaseUrlV3: 'https://api.github.com',
148
167
  prTitle: '[{targetBranch}] {commitMessages}',
149
168
  repoName: 'kibana',
150
169
  repoOwner: 'elastic',
151
170
  reviewers: [],
152
171
  sourcePRLabels: [],
153
172
  targetPRLabels: ['backport'],
154
- username: 'sqren',
173
+ author: 'sqren',
155
174
  };
156
175
  const commits = [
157
176
  {
@@ -163,13 +182,9 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
163
182
  },
164
183
  ];
165
184
  const scope = (0, nock_1.default)('https://api.github.com')
166
- .post('/repos/elastic/kibana/pulls', {
167
- title: '[6.x] My original commit message',
168
- head: 'sqren:backport/6.x/commit-mySha',
169
- base: '6.x',
170
- body: 'Backports the following commits to 6.x:\n - My original commit message (mySha)',
171
- })
185
+ .post('/repos/elastic/kibana/pulls')
172
186
  .reply(200, { number: 1337, html_url: 'myHtmlUrl' });
187
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
173
188
  res = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
174
189
  options,
175
190
  commits,
@@ -178,6 +193,25 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
178
193
  scope.done();
179
194
  nock_1.default.cleanAll();
180
195
  });
196
+ it('creates the pull request with commit reference', () => {
197
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
198
+ Array [
199
+ Object {
200
+ "base": "6.x",
201
+ "body": "# Backport
202
+
203
+ This is an automatic backport to 6.x of:
204
+ - My original commit message (mySha)
205
+
206
+ ### Questions ?
207
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
208
+ ",
209
+ "head": "sqren_authenticated:backport/6.x/commit-mySha",
210
+ "title": "[6.x] My original commit message",
211
+ },
212
+ ]
213
+ `);
214
+ });
181
215
  it('returns the expected response', () => {
182
216
  expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
183
217
  });
@@ -187,12 +221,14 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
187
221
  let promptSpy;
188
222
  let execSpy;
189
223
  let commitsByAuthorCalls;
224
+ let createPullRequestCalls;
190
225
  beforeEach(async () => {
191
226
  // spies
192
227
  promptSpy = jest.spyOn(prompts, 'confirmPrompt').mockResolvedValue(true);
193
228
  execSpy = setupExecSpyForCherryPick();
194
229
  const options = {
195
230
  assignees: [],
231
+ authenticatedUsername: 'sqren_authenticated',
196
232
  fork: true,
197
233
  githubApiBaseUrlV4: 'http://localhost/graphql',
198
234
  prTitle: '[{targetBranch}] {commitMessages}',
@@ -202,16 +238,12 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
202
238
  sourceBranch: 'myDefaultSourceBranch',
203
239
  sourcePRLabels: [],
204
240
  targetPRLabels: ['backport'],
205
- username: 'sqren',
241
+ author: 'sqren',
206
242
  };
207
243
  const scope = (0, nock_1.default)('https://api.github.com')
208
- .post('/repos/elastic/kibana/pulls', {
209
- title: '[6.x] My original commit message',
210
- head: 'sqren:backport/6.x/commit-mySha',
211
- base: '6.x',
212
- body: 'Backports the following commits to 6.x:\n - My original commit message (mySha)',
213
- })
214
- .reply(200, { html_url: 'myHtmlUrl', number: 1337 });
244
+ .post('/repos/elastic/kibana/pulls')
245
+ .reply(200, { number: 1337, html_url: 'myHtmlUrl' });
246
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
215
247
  commitsByAuthorCalls =
216
248
  (0, nockHelpers_1.mockGqlRequest)({
217
249
  name: 'CommitsByAuthor',
@@ -234,7 +266,26 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
234
266
  scope.done();
235
267
  nock_1.default.cleanAll();
236
268
  });
237
- it('creates pull request', () => {
269
+ it('creates the pull request with commit reference', () => {
270
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
271
+ Array [
272
+ Object {
273
+ "base": "6.x",
274
+ "body": "# Backport
275
+
276
+ This is an automatic backport to 6.x of:
277
+ - My original commit message (mySha)
278
+
279
+ ### Questions ?
280
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
281
+ ",
282
+ "head": "sqren_authenticated:backport/6.x/commit-mySha",
283
+ "title": "[6.x] My original commit message",
284
+ },
285
+ ]
286
+ `);
287
+ });
288
+ it('returns the expected response', () => {
238
289
  expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
239
290
  });
240
291
  it('shows the right prompts', () => {
@@ -272,6 +323,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
272
323
  Object {
273
324
  "authorId": null,
274
325
  "commitPath": "conflicting-file.txt",
326
+ "maxNumber": 10,
275
327
  "repoName": "kibana",
276
328
  "repoOwner": "elastic",
277
329
  "sourceBranch": "myDefaultSourceBranch",
@@ -288,7 +340,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
288
340
  "Pulling latest changes",
289
341
  "Cherry-picking: My original commit message",
290
342
  "Finalizing cherrypick",
291
- "Pushing branch \\"sqren:backport/6.x/commit-mySha\\"",
343
+ "Pushing branch \\"sqren_authenticated:backport/6.x/commit-mySha\\"",
292
344
  undefined,
293
345
  "Creating pull request",
294
346
  "Adding labels: backport",
@@ -517,7 +569,7 @@ function setupExecSpyForCherryPick() {
517
569
  return { stderr: '', stdout: '' };
518
570
  }
519
571
  // cherrypick
520
- if (cmd === 'git cherry-pick mySha') {
572
+ if (cmd === 'git cherry-pick -x mySha') {
521
573
  throw new ExecError_1.ExecError({ cmd });
522
574
  }
523
575
  // getIsCommitInBranch
@@ -9,13 +9,4 @@ export declare function cherrypickAndCreateTargetPullRequest({ options, commits,
9
9
  number: number;
10
10
  didUpdate: boolean;
11
11
  }>;
12
- export declare function getCommitsWithoutBackports({ options, commit, targetBranch, conflictingFiles, }: {
13
- options: ValidConfigOptions;
14
- commit: Commit;
15
- targetBranch: string;
16
- conflictingFiles: string[];
17
- }): Promise<{
18
- formatted: string;
19
- commit: Commit;
20
- }[]>;
21
12
  export declare function getBackportBranchName(targetBranch: string, commits: Commit[]): string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBackportBranchName = exports.getCommitsWithoutBackports = exports.cherrypickAndCreateTargetPullRequest = void 0;
6
+ exports.getBackportBranchName = exports.cherrypickAndCreateTargetPullRequest = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const lodash_1 = require("lodash");
9
9
  const ora = require("ora");
@@ -17,10 +17,10 @@ const addLabelsToPullRequest_1 = require("../services/github/v3/addLabelsToPullR
17
17
  const addReviewersToPullRequest_1 = require("../services/github/v3/addReviewersToPullRequest");
18
18
  const createPullRequest_1 = require("../services/github/v3/createPullRequest");
19
19
  const enablePullRequestAutoMerge_1 = require("../services/github/v4/enablePullRequestAutoMerge");
20
- const fetchCommitsByAuthor_1 = require("../services/github/v4/fetchCommits/fetchCommitsByAuthor");
21
20
  const logger_1 = require("../services/logger");
22
21
  const prompts_1 = require("../services/prompts");
23
22
  const sequentially_1 = require("../services/sequentially");
23
+ const getCommitsWithoutBackports_1 = require("./getCommitsWithoutBackports");
24
24
  async function cherrypickAndCreateTargetPullRequest({ options, commits, targetBranch, }) {
25
25
  const backportBranch = getBackportBranchName(targetBranch, commits);
26
26
  const repoForkOwner = (0, git_1.getRepoForkOwner)(options);
@@ -41,8 +41,11 @@ async function cherrypickAndCreateTargetPullRequest({ options, commits, targetBr
41
41
  commits,
42
42
  });
43
43
  // add assignees to target pull request
44
+ const assignees = options.autoAssign
45
+ ? [options.authenticatedUsername]
46
+ : options.assignees;
44
47
  if (options.assignees.length > 0) {
45
- await (0, addAssigneesToPullRequest_1.addAssigneesToPullRequest)(options, targetPullRequest.number, options.assignees);
48
+ await (0, addAssigneesToPullRequest_1.addAssigneesToPullRequest)(options, targetPullRequest.number, assignees);
46
49
  }
47
50
  // add reviewers to target pull request
48
51
  if (options.reviewers.length > 0) {
@@ -74,50 +77,12 @@ async function backportViaFilesystem({ options, prPayload, commits, targetBranch
74
77
  await (0, git_1.createBackportBranch)({ options, targetBranch, backportBranch });
75
78
  await (0, sequentially_1.sequentially)(commits, (commit) => waitForCherrypick(options, commit, targetBranch));
76
79
  if (options.resetAuthor) {
77
- await (0, git_1.setCommitAuthor)(options, options.username);
80
+ await (0, git_1.setCommitAuthor)(options, options.authenticatedUsername);
78
81
  }
79
82
  await (0, git_1.pushBackportBranch)({ options, backportBranch });
80
83
  await (0, git_1.deleteBackportBranch)({ options, backportBranch });
81
84
  return (0, createPullRequest_1.createPullRequest)({ options, prPayload });
82
85
  }
83
- // when the user is facing a git conflict we should help them understand
84
- // why the conflict occurs. In many cases it's because one or more commits haven't been backported yet
85
- async function getCommitsWithoutBackports({ options, commit, targetBranch, conflictingFiles, }) {
86
- const commitsInConflictingPaths = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
87
- ...options,
88
- all: true,
89
- commitPaths: conflictingFiles,
90
- });
91
- return (await Promise.all(commitsInConflictingPaths
92
- .filter((c) => {
93
- // exclude the commit we are currently trying to backport
94
- if (c.sha === commit.sha) {
95
- return false;
96
- }
97
- // exclude commits that are newer than the commit we are trying to backport
98
- if (c.committedDate > commit.committedDate) {
99
- return false;
100
- }
101
- const alreadyBackported = c.expectedTargetPullRequests.some((pr) => pr.branch === targetBranch && pr.state === 'MERGED');
102
- if (alreadyBackported) {
103
- return false;
104
- }
105
- return true;
106
- })
107
- .slice(0, 10) // limit to max 10 commits
108
- .map(async (c) => {
109
- const isCommitInBranch = await (0, git_1.getIsCommitInBranch)(options, c.sha);
110
- return { c, isCommitInBranch };
111
- })))
112
- .filter(({ isCommitInBranch }) => !isCommitInBranch)
113
- .map(({ c }) => {
114
- // get pull request for the target branch (if it exists)
115
- const unmergedPr = c.expectedTargetPullRequests.find((pr) => pr.branch === targetBranch);
116
- const formatted = ` - ${(0, commitFormatters_1.getFirstLine)(c.originalMessage)}${unmergedPr?.state === 'OPEN' ? chalk_1.default.gray(' (backport pending)') : ''}${c.pullUrl ? `\n ${c.pullUrl}` : ''}`;
117
- return { formatted, commit: c };
118
- });
119
- }
120
- exports.getCommitsWithoutBackports = getCommitsWithoutBackports;
121
86
  /*
122
87
  * Returns the name of the backport branch without remote name
123
88
  *
@@ -174,23 +139,23 @@ async function waitForCherrypick(options, commit, targetBranch) {
174
139
  }
175
140
  autoResolveSpinner.fail();
176
141
  }
177
- const commitsWithoutBackports = await getCommitsWithoutBackports({
142
+ const commitsWithoutBackports = await (0, getCommitsWithoutBackports_1.getCommitsWithoutBackports)({
178
143
  options,
179
144
  commit,
180
145
  targetBranch,
181
146
  conflictingFiles: conflictingFiles.map((f) => f.relative).slice(0, 50),
182
147
  });
183
- (0, logger_1.consoleLog)(chalk_1.default.bold('\nThe commit could not be backported due to conflicts\n'));
184
- if (commitsWithoutBackports.length > 0) {
185
- (0, logger_1.consoleLog)(chalk_1.default.italic(`Hint: Before fixing the conflicts manually you should consider backporting the following commits to "${targetBranch}":`));
186
- (0, logger_1.consoleLog)(`${commitsWithoutBackports.map((c) => c.formatted).join('\n')}\n\n`);
187
- }
188
148
  if (options.ci) {
189
149
  throw new HandledError_1.HandledError(`Commit could not be cherrypicked due to conflicts`, {
190
150
  type: 'commitsWithoutBackports',
191
151
  commitsWithoutBackports,
192
152
  });
193
153
  }
154
+ (0, logger_1.consoleLog)(chalk_1.default.bold('\nThe commit could not be backported due to conflicts\n'));
155
+ if (commitsWithoutBackports.length > 0) {
156
+ (0, logger_1.consoleLog)(chalk_1.default.italic(`Hint: Before fixing the conflicts manually you should consider backporting the following commits to "${targetBranch}":`));
157
+ (0, logger_1.consoleLog)(`${commitsWithoutBackports.map((c) => c.formatted).join('\n')}\n\n`);
158
+ }
194
159
  /*
195
160
  * Commit could not be cleanly cherrypicked: Initiating conflict resolution
196
161
  */