Skip to content

Commit

Permalink
Update message about conflict resolution (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Apr 29, 2019
1 parent 473bbc3 commit 0556820
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 128 deletions.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@
"ts",
"js",
"json"
]
],
"globals": {
"ts-jest": {
"diagnostics": false
}
}
},
"engines": {
"node": ">=8.0.0"
Expand Down Expand Up @@ -96,6 +101,7 @@
"@types/lodash.get": "^4.4.6",
"@types/lodash.isempty": "^4.4.6",
"@types/lodash.isstring": "^4.0.6",
"@types/lodash.last": "^3.0.6",
"@types/mkdirp": "^0.5.2",
"@types/nock": "^10.0.0",
"@types/node": "^10.14.4",
Expand Down
10 changes: 7 additions & 3 deletions src/steps/doBackportVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,16 @@ async function cherrypickAndConfirm(
await cherrypick({ owner, repoName, sha });
spinner.succeed();
} catch (e) {
spinner.fail(
`Cherry-picking failed. Please resolve conflicts in: ${getRepoPath(
spinner.fail(`Cherry-picking failed.\n`);
log(
`Please resolve conflicts in: ${getRepoPath(
owner,
repoName
)}`
)} and when all conflicts have been resolved and staged run:`
);
log(`
git cherry-pick --continue
`);

const hasConflict = e.cmd.includes('git cherry-pick');
if (!hasConflict) {
Expand Down
59 changes: 21 additions & 38 deletions test/steps/__snapshots__/doBackportVersions.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`doBackportVersion with pull request reference 1`] = `
Object {
"html_url": "myHtmlUrl",
"number": 1337,
}
`;

exports[`doBackportVersion with pull request reference 2`] = `
exports[`doBackportVersion when cherry-picking fails and conflicts were not resolved 2`] = `
Array [
Array [
"git reset --hard && git clean -d --force && git checkout master && git pull origin master",
Expand All @@ -18,7 +11,7 @@ Array [
[Function],
],
Array [
"git fetch origin 6.x && git branch backport/6.x/pr-1000_pr-2000 origin/6.x --force && git checkout backport/6.x/pr-1000_pr-2000 ",
"git fetch origin 6.x && git branch backport/6.x/commit-mySha origin/6.x --force && git checkout backport/6.x/commit-mySha ",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand All @@ -33,33 +26,10 @@ Array [
},
[Function],
],
Array [
"git cherry-pick mySha2",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
},
[Function],
],
Array [
"git push sqren backport/6.x/pr-1000_pr-2000:backport/6.x/pr-1000_pr-2000 --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
},
[Function],
],
]
`;

exports[`doBackportVersion without pull request reference 1`] = `
Object {
"html_url": "myHtmlUrl",
"number": 1337,
}
`;

exports[`doBackportVersion without pull request reference 2`] = `
exports[`doBackportVersion when cherry-picking fails and conflicts were resolved 1`] = `
Array [
Array [
"git reset --hard && git clean -d --force && git checkout master && git pull origin master",
Expand All @@ -70,7 +40,7 @@ Array [
[Function],
],
Array [
"git fetch origin 6.x && git branch backport/6.x/pr-1000_pr-2000 origin/6.x --force && git checkout backport/6.x/pr-1000_pr-2000 ",
"git fetch origin 6.x && git branch backport/6.x/commit-mySha origin/6.x --force && git checkout backport/6.x/commit-mySha ",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand All @@ -86,21 +56,26 @@ Array [
[Function],
],
Array [
"git cherry-pick mySha2",
"git diff-index --quiet HEAD --",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
},
[Function],
],
Array [
"git push sqren backport/6.x/pr-1000_pr-2000:backport/6.x/pr-1000_pr-2000 --force",
"git push sqren backport/6.x/commit-mySha:backport/6.x/commit-mySha --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
},
[Function],
],
]
`;

exports[`doBackportVersion when commit has a pull request reference should make correct git commands 1`] = `
Array [
Array [
"git reset --hard && git clean -d --force && git checkout master && git pull origin master",
Object {
Expand All @@ -110,7 +85,7 @@ Array [
[Function],
],
Array [
"git fetch origin 6.x && git branch backport/6.x/commit-mySha origin/6.x --force && git checkout backport/6.x/commit-mySha ",
"git fetch origin 6.x && git branch backport/6.x/pr-1000_pr-2000 origin/6.x --force && git checkout backport/6.x/pr-1000_pr-2000 ",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand All @@ -126,7 +101,15 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.x/commit-mySha:backport/6.x/commit-mySha --force",
"git cherry-pick mySha2",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
},
[Function],
],
Array [
"git push sqren backport/6.x/pr-1000_pr-2000:backport/6.x/pr-1000_pr-2000 --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down
Loading

0 comments on commit 0556820

Please sign in to comment.