Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filepath to conflict message #306

Merged
merged 1 commit into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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