Skip to content

Commit

Permalink
Add filepath to conflict message (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Feb 21, 2022
1 parent baa0ff7 commit c1f84eb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Backport

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
branches: [ main ]

jobs:
build:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
1 change: 0 additions & 1 deletion src/entrypoint.cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node
import yargsParser from 'yargs-parser';
import { backportRun } from './backportRun';
import { ConfigFileOptions } from './entrypoint.module';
Expand Down
22 changes: 8 additions & 14 deletions src/ui/cherrypickAndCreateTargetPullRequest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,24 +397,18 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
});

it('logs correctly', async () => {
expect(consoleLogSpy.mock.calls[0][0]).toMatchInlineSnapshot(`
"
Backporting to 6.x:"
`);
expect(consoleLogSpy.mock.calls[1][0]).toMatchInlineSnapshot(`
expect(consoleLogSpy.mock.calls.map((call) => call[0]).join(''))
.toMatchInlineSnapshot(`
"
Backporting to 6.x:
The commit could not be backported due to conflicts
"
`);
expect(consoleLogSpy.mock.calls[2][0]).toMatchInlineSnapshot(`
"
Please fix the conflicts in /myHomeDir/.backport/repositories/elastic/kibana
----------------------------------------
"
`);
expect(consoleLogSpy.mock.calls[3][0]).toMatchInlineSnapshot(`
"
----------------------------------------
"
----------------------------------------
View pull request: myHtmlUrl"
`);
});
});
Expand Down
5 changes: 3 additions & 2 deletions src/ui/cherrypickAndCreateTargetPullRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ async function waitForCherrypick(
throw e;
}

const repoPath = getRepoPath(options);

// resolve conflicts automatically
if (options.autoFixConflicts) {
const autoResolveSpinner = ora(
options.ci,
'Attempting to resolve conflicts automatically'
).start();

const repoPath = getRepoPath(options);
const didAutoFix = await options.autoFixConflicts({
files: conflictingFiles.map((f) => f.absolute),
directory: repoPath,
Expand Down Expand Up @@ -232,6 +233,7 @@ async function waitForCherrypick(
consoleLog(
chalk.bold('\nThe commit could not be backported due to conflicts\n')
);
consoleLog(`Please fix the conflicts in ${repoPath}`);

if (commitsWithoutBackports.length > 0) {
consoleLog(
Expand All @@ -250,7 +252,6 @@ async function waitForCherrypick(
*/

if (options.editor) {
const repoPath = getRepoPath(options);
await exec(`${options.editor} ${repoPath}`, { cwd: options.cwd });
}

Expand Down

0 comments on commit c1f84eb

Please sign in to comment.