backport 7.3.6 → 8.1.0
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.
- package/README.md +16 -21
- package/dist/backportRun.d.ts +18 -6
- package/dist/backportRun.js +70 -50
- package/dist/entrypoint.cli.js +4 -8
- package/dist/entrypoint.module.d.ts +13 -6
- package/dist/entrypoint.module.js +17 -19
- package/dist/entrypoint.module.private.test.js +129 -330
- package/dist/errors/BackportError.d.ts +19 -0
- package/dist/errors/BackportError.js +29 -0
- package/dist/lib/BackportError.d.ts +19 -0
- package/dist/lib/BackportError.js +29 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.d.ts +13 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.js +238 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +321 -0
- package/dist/lib/child-process-promisified.d.ts +25 -0
- package/dist/lib/child-process-promisified.js +58 -0
- package/dist/lib/env.d.ts +7 -0
- package/dist/lib/env.js +33 -0
- package/dist/lib/env.test.d.ts +1 -0
- package/dist/lib/env.test.js +26 -0
- package/dist/lib/getCommits.d.ts +2 -0
- package/dist/lib/getCommits.js +75 -0
- package/dist/lib/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/lib/getCommitsWithoutBackports.js +68 -0
- package/dist/lib/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/lib/getCommitsWithoutBackports.test.js +335 -0
- package/dist/lib/getGitConfigAuthor.d.ts +6 -0
- package/dist/lib/getGitConfigAuthor.js +15 -0
- package/dist/lib/getTargetBranches.d.ts +5 -0
- package/dist/lib/getTargetBranches.js +67 -0
- package/dist/lib/getTargetBranches.test.d.ts +1 -0
- package/dist/lib/getTargetBranches.test.js +206 -0
- package/dist/lib/git.d.ts +77 -0
- package/dist/lib/git.js +439 -0
- package/dist/lib/git.private.test.d.ts +1 -0
- package/dist/lib/git.private.test.js +618 -0
- package/dist/lib/git.test.d.ts +1 -0
- package/dist/lib/git.test.js +580 -0
- package/dist/lib/github/commitFormatters.d.ts +3 -0
- package/dist/lib/github/commitFormatters.js +17 -0
- package/dist/lib/github/commitFormatters.test.d.ts +1 -0
- package/dist/lib/github/commitFormatters.test.js +11 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.js +32 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.test.d.ts +1 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.test.js +27 -0
- package/dist/lib/github/v3/addLabelsToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addLabelsToPullRequest.js +30 -0
- package/dist/lib/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addReviewersToPullRequest.js +32 -0
- package/dist/lib/github/v3/createPullRequest.d.ts +29 -0
- package/dist/lib/github/v3/createPullRequest.js +91 -0
- package/dist/lib/github/v3/createPullRequest.test.d.ts +1 -0
- package/dist/lib/github/v3/createPullRequest.test.js +377 -0
- package/dist/lib/github/v3/createStatusComment.d.ts +11 -0
- package/dist/lib/github/v3/createStatusComment.js +136 -0
- package/dist/lib/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/lib/github/v3/createStatusComment.test.js +461 -0
- package/dist/lib/github/v3/getGithubV3ErrorMessage.d.ts +14 -0
- package/dist/lib/github/v3/getGithubV3ErrorMessage.js +16 -0
- package/dist/lib/github/v4/FetchPullRequestId.d.ts +2 -0
- package/dist/lib/github/v4/FetchPullRequestId.js +36 -0
- package/dist/lib/github/v4/apiRequestV4.d.ts +31 -0
- package/dist/lib/github/v4/apiRequestV4.js +71 -0
- package/dist/lib/github/v4/apiRequestV4.test.d.ts +1 -0
- package/dist/lib/github/v4/apiRequestV4.test.js +109 -0
- package/dist/lib/github/v4/disablePullRequestAutoMerge.d.ts +2 -0
- package/dist/lib/github/v4/disablePullRequestAutoMerge.js +32 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.d.ts +2 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.js +50 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
- package/dist/lib/github/v4/fetchAuthorId.d.ts +10 -0
- package/dist/lib/github/v4/fetchAuthorId.js +28 -0
- package/dist/lib/github/v4/fetchAuthorId.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchAuthorId.private.test.js +25 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +93 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +11 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +58 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +136 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.d.ts +11 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +48 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +118 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +29 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +110 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +196 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +157 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +107 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +69 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.d.ts +9 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.js +64 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.private.test.js +44 -0
- package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.d.ts +2 -0
- package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.js +39 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.js +49 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.js +49 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +72 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +78 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +116 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +16 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.js +29 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.js +61 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +1 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +72 -0
- package/dist/lib/github/v4/mocks/commitsByAuthorMock.d.ts +2 -0
- package/dist/lib/github/v4/mocks/commitsByAuthorMock.js +176 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.d.ts +7 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.js +45 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.test.d.ts +1 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.test.js +87 -0
- package/dist/lib/logger.d.ts +9 -0
- package/dist/lib/logger.js +74 -0
- package/dist/lib/ora.d.ts +2 -0
- package/dist/lib/ora.js +21 -0
- package/dist/lib/prompt.test.d.ts +1 -0
- package/dist/lib/prompt.test.js +139 -0
- package/dist/lib/prompts.d.ts +17 -0
- package/dist/lib/prompts.js +132 -0
- package/dist/lib/remoteConfig.d.ts +20 -0
- package/dist/lib/remoteConfig.js +52 -0
- package/dist/lib/sequentially.d.ts +1 -0
- package/dist/lib/sequentially.js +10 -0
- package/dist/lib/setupRepo.d.ts +2 -0
- package/dist/lib/setupRepo.js +56 -0
- package/dist/lib/setupRepo.test.d.ts +1 -0
- package/dist/lib/setupRepo.test.js +278 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +16 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.js +102 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.js +467 -0
- package/dist/lib/sourceCommit/getMockSourceCommit.d.ts +26 -0
- package/dist/lib/sourceCommit/getMockSourceCommit.js +103 -0
- package/dist/lib/sourceCommit/parseSourceCommit.d.ts +108 -0
- package/dist/lib/sourceCommit/parseSourceCommit.js +123 -0
- package/dist/lib/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/lib/sourceCommit/parseSourceCommit.test.js +226 -0
- package/dist/options/ConfigOptions.d.ts +6 -4
- package/dist/options/cliArgs.d.ts +16 -9
- package/dist/options/cliArgs.js +54 -28
- package/dist/options/cliArgs.test.js +128 -4
- package/dist/options/config/config.d.ts +7 -6
- package/dist/options/config/config.js +5 -7
- package/dist/options/config/config.test.js +0 -1
- package/dist/options/config/globalConfig.d.ts +5 -3
- package/dist/options/config/globalConfig.js +17 -14
- package/dist/options/config/projectConfig.d.ts +2 -2
- package/dist/options/config/projectConfig.js +3 -3
- package/dist/options/config/projectConfig.test.js +19 -7
- package/dist/options/config/readConfigFile.d.ts +9 -7
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +44 -9
- package/dist/options/options.js +22 -27
- package/dist/options/options.test.js +119 -58
- package/dist/runSequentially.d.ts +14 -7
- package/dist/runSequentially.js +26 -11
- package/dist/scripts/postinstall.js +4 -3
- package/dist/scripts/postinstall.test.js +6 -2
- package/dist/services/BackportError.d.ts +19 -0
- package/dist/services/BackportError.js +29 -0
- package/dist/services/HandledBackportError.d.ts +19 -0
- package/dist/services/HandledBackportError.js +29 -0
- package/dist/services/HandledError.d.ts +7 -3
- package/dist/services/HandledError.js +13 -13
- package/dist/services/child-process-promisified.d.ts +19 -3
- package/dist/services/child-process-promisified.js +46 -17
- package/dist/services/git.d.ts +6 -7
- package/dist/services/git.integration.test.js +381 -65
- package/dist/services/git.js +189 -127
- package/dist/services/git.private.test.d.ts +1 -0
- package/dist/services/git.private.test.js +618 -0
- package/dist/services/git.test.js +167 -158
- package/dist/services/github/v3/addAssigneesToPullRequest.js +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +1 -1
- package/dist/services/github/v3/addReviewersToPullRequest.js +2 -1
- package/dist/services/github/v3/createPullRequest.js +4 -2
- package/dist/services/github/v3/createStatusComment.js +17 -17
- package/dist/services/github/v3/createStatusComment.test.js +22 -9
- package/dist/services/github/v4/apiRequestV4.js +8 -11
- package/dist/services/github/v4/apiRequestV4.test.js +2 -2
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +2 -4
- package/dist/services/github/v4/fetchAuthorId.private.test.js +3 -6
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +5 -6
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +4 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +10 -9
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +10 -9
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +9 -8
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +3 -6
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +3 -2
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -6
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +4 -7
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +2 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +2 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +6 -7
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +9 -8
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +5 -5
- package/dist/services/logger.d.ts +1 -4
- package/dist/services/logger.js +14 -19
- package/dist/services/test.d.ts +1 -0
- package/dist/services/test.js +23 -0
- package/dist/state.d.ts +0 -0
- package/dist/state.js +1 -0
- package/dist/test/e2e/cli/commit-author.private.test.js +4 -4
- package/dist/test/e2e/cli/different-merge-strategies.private.test.js +26 -24
- package/dist/test/e2e/cli/entrypoint.cli.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +450 -0
- package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +27 -28
- package/dist/test/e2e/cli/runBackportViaCli.d.ts +6 -2
- package/dist/test/e2e/cli/runBackportViaCli.js +44 -23
- package/dist/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +22 -14
- package/dist/test/e2e/module/entrypoint.module.mutation.test.d.ts +1 -0
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +376 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +12 -10
- package/dist/test/sandbox.js +5 -1
- package/dist/test/setupFiles/automatic-mocks.js +17 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +11 -7
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +7 -159
- package/dist/ui/getCommits.js +2 -2
- package/dist/ui/getCommitsWithoutBackports.test.js +5 -1
- package/dist/ui/getGitConfigAuthor.js +1 -1
- package/dist/ui/getTargetBranches.js +3 -3
- package/dist/ui/getTargetBranches.test.js +5 -1
- package/dist/ui/ora.d.ts +1 -8
- package/dist/ui/setupRepo.js +3 -3
- package/dist/ui/setupRepo.test.js +98 -61
- package/dist/utils/isErrnoError.d.ts +2 -0
- package/dist/utils/isErrnoError.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +17 -17
- package/yarn.lock +461 -695
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -23,18 +27,15 @@ const graphql_1 = require("graphql");
|
|
|
23
27
|
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
24
28
|
const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
25
29
|
const fetchCommitsByAuthor_1 = require("./fetchCommitsByAuthor");
|
|
30
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
26
31
|
describe('fetchCommitsByAuthor', () => {
|
|
27
|
-
let devAccessToken;
|
|
28
|
-
beforeAll(() => {
|
|
29
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
30
|
-
});
|
|
31
32
|
describe('snapshot request/response', () => {
|
|
32
33
|
let spy;
|
|
33
34
|
let commits;
|
|
34
35
|
beforeEach(async () => {
|
|
35
36
|
spy = jest.spyOn(apiRequestV4Module, 'apiRequestV4');
|
|
36
37
|
commits = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
37
|
-
accessToken
|
|
38
|
+
accessToken,
|
|
38
39
|
author: 'sqren',
|
|
39
40
|
maxNumber: 10,
|
|
40
41
|
repoName: 'kibana',
|
|
@@ -64,7 +65,7 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
64
65
|
});
|
|
65
66
|
describe('commitPaths', () => {
|
|
66
67
|
const getOptions = () => ({
|
|
67
|
-
accessToken
|
|
68
|
+
accessToken,
|
|
68
69
|
author: 'sqren',
|
|
69
70
|
maxNumber: 10,
|
|
70
71
|
repoName: 'repo-with-different-commit-paths',
|
|
@@ -138,7 +139,7 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
138
139
|
let res;
|
|
139
140
|
beforeEach(async () => {
|
|
140
141
|
res = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
141
|
-
accessToken
|
|
142
|
+
accessToken,
|
|
142
143
|
commitPaths: [],
|
|
143
144
|
maxNumber: 10,
|
|
144
145
|
repoName: 'backport-e2e',
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
4
4
|
const fetchPullRequestsBySearchQuery_1 = require("./fetchPullRequestsBySearchQuery");
|
|
5
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
5
6
|
describe('fetchPullRequestsBySearchQuery', () => {
|
|
6
|
-
let devAccessToken;
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
-
});
|
|
10
7
|
describe('when filter does not match any PRs', () => {
|
|
11
8
|
it('throws an error', async () => {
|
|
12
9
|
const options = {
|
|
13
|
-
accessToken
|
|
10
|
+
accessToken,
|
|
14
11
|
maxNumber: 10,
|
|
15
12
|
prFilter: 'label:non-existing',
|
|
16
13
|
repoName: 'backport-e2e',
|
|
@@ -30,7 +27,7 @@ describe('fetchPullRequestsBySearchQuery', () => {
|
|
|
30
27
|
describe('when filter matches PRs', () => {
|
|
31
28
|
it('returns the merge commits for those PRs', async () => {
|
|
32
29
|
const options = {
|
|
33
|
-
accessToken
|
|
30
|
+
accessToken,
|
|
34
31
|
maxNumber: 10,
|
|
35
32
|
prFilter: 'label:v7.8.0',
|
|
36
33
|
repoName: 'backport-e2e',
|
|
@@ -7,7 +7,7 @@ exports.fetchPullRequestsBySearchQuery = void 0;
|
|
|
7
7
|
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
8
|
const lodash_1 = require("lodash");
|
|
9
9
|
const filterUnmergedCommits_1 = require("../../../../utils/filterUnmergedCommits");
|
|
10
|
-
const
|
|
10
|
+
const BackportError_1 = require("../../../BackportError");
|
|
11
11
|
const remoteConfig_1 = require("../../../remoteConfig");
|
|
12
12
|
const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
|
|
13
13
|
const apiRequestV4_1 = require("../apiRequestV4");
|
|
@@ -47,6 +47,7 @@ async function fetchPullRequestsBySearchQuery(options) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
catch (e) {
|
|
50
|
+
//@ts-expect-error
|
|
50
51
|
res = (0, remoteConfig_1.swallowMissingConfigFileException)(e);
|
|
51
52
|
}
|
|
52
53
|
const commits = res.search.nodes.map((pullRequestNode) => {
|
|
@@ -58,7 +59,7 @@ async function fetchPullRequestsBySearchQuery(options) {
|
|
|
58
59
|
const errorText = author
|
|
59
60
|
? `No commits found for query:\n ${searchQuery}\n\nUse \`--all\` to see commits by all users or \`--author=<username>\` for commits from a specific user`
|
|
60
61
|
: `No commits found for query:\n ${searchQuery}`;
|
|
61
|
-
throw new
|
|
62
|
+
throw new BackportError_1.BackportError(errorText);
|
|
62
63
|
}
|
|
63
64
|
if (options.onlyMissing) {
|
|
64
65
|
return commits.filter(filterUnmergedCommits_1.filterUnmergedCommits);
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
4
|
const fetchExistingPullRequest_1 = require("./fetchExistingPullRequest");
|
|
5
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
5
6
|
describe('fetchExistingPullRequest', () => {
|
|
6
|
-
let devAccessToken;
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
-
});
|
|
10
7
|
describe('when PR does not exist', () => {
|
|
11
8
|
it('returns undefined', async () => {
|
|
12
9
|
const options = {
|
|
13
|
-
accessToken
|
|
10
|
+
accessToken,
|
|
14
11
|
};
|
|
15
12
|
const prPayload = {
|
|
16
13
|
owner: 'backport-org',
|
|
@@ -27,7 +24,7 @@ describe('fetchExistingPullRequest', () => {
|
|
|
27
24
|
describe('when PR exists', () => {
|
|
28
25
|
it('returns the PR number and url', async () => {
|
|
29
26
|
const options = {
|
|
30
|
-
accessToken
|
|
27
|
+
accessToken,
|
|
31
28
|
};
|
|
32
29
|
const prPayload = {
|
|
33
30
|
owner: 'backport-org',
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
4
|
const fetchRemoteProjectConfig_1 = require("./fetchRemoteProjectConfig");
|
|
5
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
5
6
|
describe('fetchRemoteProjectConfig', () => {
|
|
6
|
-
let devAccessToken;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
-
});
|
|
10
7
|
it('returns the backport config from "main" branch', async () => {
|
|
11
8
|
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
12
9
|
repoOwner: 'backport-org',
|
|
13
10
|
repoName: 'repo-with-project-config',
|
|
14
|
-
accessToken
|
|
11
|
+
accessToken,
|
|
15
12
|
sourceBranch: 'main',
|
|
16
13
|
});
|
|
17
14
|
expect(projectConfig).toEqual({
|
|
@@ -31,7 +28,7 @@ describe('fetchRemoteProjectConfig', () => {
|
|
|
31
28
|
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
32
29
|
repoOwner: 'backport-org',
|
|
33
30
|
repoName: 'repo-with-project-config',
|
|
34
|
-
accessToken
|
|
31
|
+
accessToken,
|
|
35
32
|
sourceBranch: 'branch-with-legacy-config',
|
|
36
33
|
});
|
|
37
34
|
expect(projectConfig).toEqual({
|
|
@@ -44,7 +41,7 @@ describe('fetchRemoteProjectConfig', () => {
|
|
|
44
41
|
const promise = (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
45
42
|
repoOwner: 'backport-org',
|
|
46
43
|
repoName: 'repo-with-project-config',
|
|
47
|
-
accessToken
|
|
44
|
+
accessToken,
|
|
48
45
|
sourceBranch: 'branch-with-no-config',
|
|
49
46
|
});
|
|
50
47
|
await expect(promise).rejects.toThrowError('Project config does not exist');
|
|
@@ -23,9 +23,9 @@ export declare function getOptionsFromGithub(options: {
|
|
|
23
23
|
cherrypickRef?: boolean | undefined;
|
|
24
24
|
ci?: boolean | undefined;
|
|
25
25
|
commitPaths?: string[] | undefined;
|
|
26
|
-
configFile?: string | undefined;
|
|
27
26
|
details?: boolean | undefined;
|
|
28
27
|
dir?: string | undefined;
|
|
28
|
+
dryRun?: boolean | undefined;
|
|
29
29
|
editor?: string | undefined;
|
|
30
30
|
fork?: boolean | undefined;
|
|
31
31
|
gitAuthorEmail?: string | undefined;
|
|
@@ -42,6 +42,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
42
42
|
noVerify?: boolean | undefined;
|
|
43
43
|
prDescription?: string | undefined;
|
|
44
44
|
prFilter?: string | undefined;
|
|
45
|
+
projectConfigFile?: string | undefined;
|
|
45
46
|
prTitle?: string | undefined;
|
|
46
47
|
publishStatusComment?: boolean | undefined;
|
|
47
48
|
pullNumber?: number | undefined;
|
|
@@ -57,7 +58,6 @@ export declare function getOptionsFromGithub(options: {
|
|
|
57
58
|
targetBranchChoices?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
58
59
|
targetBranches?: string[] | undefined;
|
|
59
60
|
targetPRLabels?: string[] | undefined;
|
|
60
|
-
verbose?: boolean | undefined;
|
|
61
61
|
help?: boolean | undefined;
|
|
62
62
|
version?: boolean | undefined;
|
|
63
63
|
v?: boolean | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOptionsFromGithub = void 0;
|
|
4
|
-
const
|
|
4
|
+
const BackportError_1 = require("../../../BackportError");
|
|
5
5
|
const git_1 = require("../../../git");
|
|
6
6
|
const logger_1 = require("../../../logger");
|
|
7
7
|
const remoteConfig_1 = require("../../../remoteConfig");
|
|
@@ -28,7 +28,7 @@ async function getOptionsFromGithub(options) {
|
|
|
28
28
|
}
|
|
29
29
|
// it is not possible to have a branch named "backport"
|
|
30
30
|
if (res.repository.illegalBackportBranch) {
|
|
31
|
-
throw new
|
|
31
|
+
throw new BackportError_1.BackportError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
|
|
32
32
|
}
|
|
33
33
|
const remoteConfig = await getRemoteConfigFileOptions(res, options.cwd, options.skipRemoteConfig);
|
|
34
34
|
return {
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const os_1 = __importDefault(require("os"));
|
|
7
7
|
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
8
8
|
const getOptionsFromGithub_1 = require("./getOptionsFromGithub");
|
|
9
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
10
|
describe('getOptionsFromGithub', () => {
|
|
10
|
-
let devAccessToken;
|
|
11
11
|
beforeAll(async () => {
|
|
12
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
13
12
|
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
14
13
|
});
|
|
15
14
|
describe('access token', () => {
|
|
@@ -29,7 +28,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
29
28
|
it('returns the options', async () => {
|
|
30
29
|
const combinedOptions = {
|
|
31
30
|
author: 'sqren',
|
|
32
|
-
accessToken
|
|
31
|
+
accessToken,
|
|
33
32
|
repoOwner: 'backport-org',
|
|
34
33
|
repoName: 'backport-e2e',
|
|
35
34
|
cwd: process.cwd(),
|
|
@@ -58,7 +57,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
58
57
|
it('returns original repoOwner', async () => {
|
|
59
58
|
const combinedOptions = {
|
|
60
59
|
author: 'sqren',
|
|
61
|
-
accessToken
|
|
60
|
+
accessToken,
|
|
62
61
|
repoOwner: 'sqren',
|
|
63
62
|
repoName: 'backport-e2e',
|
|
64
63
|
cwd: process.cwd(),
|
|
@@ -72,7 +71,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
72
71
|
it('uses the default branch of the repo', async () => {
|
|
73
72
|
const combinedOptions = {
|
|
74
73
|
author: 'sqren',
|
|
75
|
-
accessToken
|
|
74
|
+
accessToken,
|
|
76
75
|
repoOwner: 'backport-org',
|
|
77
76
|
repoName: 'repo-with-non-standard-main-branch',
|
|
78
77
|
cwd: process.cwd(),
|
|
@@ -87,7 +86,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
87
86
|
it('shows a warning', async () => {
|
|
88
87
|
const combinedOptions = {
|
|
89
88
|
author: 'sqren',
|
|
90
|
-
accessToken
|
|
89
|
+
accessToken,
|
|
91
90
|
repoOwner: 'backport-org',
|
|
92
91
|
repoName: 'repo-with-branch-named-backport',
|
|
93
92
|
cwd: process.cwd(),
|
|
@@ -102,7 +101,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
102
101
|
it('does not throw', async () => {
|
|
103
102
|
const combinedOptions = {
|
|
104
103
|
author: 'sqren',
|
|
105
|
-
accessToken
|
|
104
|
+
accessToken,
|
|
106
105
|
repoOwner: 'backport-org',
|
|
107
106
|
repoName: 'repo-with-backportrc-removed',
|
|
108
107
|
cwd: process.cwd(),
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -24,11 +28,8 @@ const sandbox_1 = require("../../../test/sandbox");
|
|
|
24
28
|
const childProcess = __importStar(require("../../child-process-promisified"));
|
|
25
29
|
const getRepoOwnerAndNameFromGitRemotes_1 = require("./getRepoOwnerAndNameFromGitRemotes");
|
|
26
30
|
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
31
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
27
32
|
describe('fetchRemoteProjectConfig', () => {
|
|
28
|
-
let devAccessToken;
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
31
|
-
});
|
|
32
33
|
describe('when the remote is a fork', () => {
|
|
33
34
|
it('retrives the original owner from github', async () => {
|
|
34
35
|
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
@@ -36,7 +37,7 @@ describe('fetchRemoteProjectConfig', () => {
|
|
|
36
37
|
await childProcess.exec(`git init`, execOpts);
|
|
37
38
|
await childProcess.exec(`git remote add sqren git@github.com:sqren/kibana.git`, execOpts);
|
|
38
39
|
expect(await (0, getRepoOwnerAndNameFromGitRemotes_1.getRepoOwnerAndNameFromGitRemotes)({
|
|
39
|
-
accessToken
|
|
40
|
+
accessToken,
|
|
40
41
|
cwd: sandboxPath,
|
|
41
42
|
})).toEqual({
|
|
42
43
|
repoName: 'kibana',
|
|
@@ -52,7 +53,7 @@ describe('fetchRemoteProjectConfig', () => {
|
|
|
52
53
|
await childProcess.exec(`git remote add foo git@github.com:foo/kibana.git`, execOpts);
|
|
53
54
|
await childProcess.exec(`git remote add bar git@github.com:bar/kibana.git`, execOpts);
|
|
54
55
|
expect(await (0, getRepoOwnerAndNameFromGitRemotes_1.getRepoOwnerAndNameFromGitRemotes)({
|
|
55
|
-
accessToken
|
|
56
|
+
accessToken,
|
|
56
57
|
cwd: sandboxPath,
|
|
57
58
|
})).toEqual({});
|
|
58
59
|
});
|
|
@@ -63,7 +64,7 @@ describe('fetchRemoteProjectConfig', () => {
|
|
|
63
64
|
const execOpts = { cwd: sandboxPath };
|
|
64
65
|
await childProcess.exec(`git init`, execOpts);
|
|
65
66
|
expect(await (0, getRepoOwnerAndNameFromGitRemotes_1.getRepoOwnerAndNameFromGitRemotes)({
|
|
66
|
-
accessToken
|
|
67
|
+
accessToken,
|
|
67
68
|
cwd: sandboxPath,
|
|
68
69
|
})).toEqual({});
|
|
69
70
|
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.throwOnInvalidAccessToken = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const maybe_1 = require("../../../utils/maybe");
|
|
6
|
-
const
|
|
6
|
+
const BackportError_1 = require("../../BackportError");
|
|
7
7
|
const env_1 = require("../../env");
|
|
8
8
|
function throwOnInvalidAccessToken({ error, repoOwner, repoName, }) {
|
|
9
9
|
function getSSOAuthUrl(ssoHeader) {
|
|
@@ -23,21 +23,21 @@ function throwOnInvalidAccessToken({ error, repoOwner, repoName, }) {
|
|
|
23
23
|
const hasRequiredScopes = (0, lodash_1.isEmpty)((0, lodash_1.difference)(requiredScopes.split(','), grantedScopes.split(',')));
|
|
24
24
|
// user does not have permission to the repo
|
|
25
25
|
if (!hasRequiredScopes) {
|
|
26
|
-
throw new
|
|
26
|
+
throw new BackportError_1.BackportError(`You do not have access to the repository "${repoOwner}/${repoName}". Please make sure your access token has the required scopes.\n\nRequired scopes: ${requiredScopes}\nAccess token scopes: ${grantedScopes}`);
|
|
27
27
|
}
|
|
28
28
|
// repo does not exist
|
|
29
|
-
throw new
|
|
29
|
+
throw new BackportError_1.BackportError(`The repository "${repoOwner}/${repoName}" doesn't exist`);
|
|
30
30
|
}
|
|
31
31
|
const repoAccessForbidden = error.githubResponse.data.errors?.some((error) => error.type === 'FORBIDDEN');
|
|
32
32
|
const ssoAuthUrl = getSSOAuthUrl(ssoHeader);
|
|
33
33
|
// user does not have permissions
|
|
34
34
|
if (repoAccessForbidden && ssoAuthUrl) {
|
|
35
|
-
throw new
|
|
35
|
+
throw new BackportError_1.BackportError(`Please follow the link to authorize your personal access token with SSO:\n\n${ssoAuthUrl}`);
|
|
36
36
|
}
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
39
|
case 401:
|
|
40
|
-
throw new
|
|
40
|
+
throw new BackportError_1.BackportError(`Please check your access token and make sure it is valid.\nConfig: ${(0, env_1.getGlobalConfigPath)()}`);
|
|
41
41
|
default:
|
|
42
42
|
return undefined;
|
|
43
43
|
}
|
|
@@ -6,7 +6,4 @@ export declare function initLogger({ ci, accessToken, logFilePath, }: {
|
|
|
6
6
|
logFilePath?: string;
|
|
7
7
|
}): winston.Logger;
|
|
8
8
|
export declare function consoleLog(message: string): void;
|
|
9
|
-
export declare function
|
|
10
|
-
accessToken: string;
|
|
11
|
-
verbose?: boolean;
|
|
12
|
-
}): void;
|
|
9
|
+
export declare function setAccessToken(accessToken: string): void;
|
package/dist/services/logger.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -19,17 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
26
|
+
exports.setAccessToken = exports.consoleLog = exports.initLogger = exports.logger = void 0;
|
|
23
27
|
const winston_1 = __importStar(require("winston"));
|
|
24
28
|
const redact_1 = require("../utils/redact");
|
|
25
29
|
const env_1 = require("./env");
|
|
26
30
|
let _accessToken;
|
|
27
31
|
let _ci;
|
|
28
32
|
function initLogger({ ci, accessToken, logFilePath, }) {
|
|
29
|
-
|
|
30
|
-
if (accessToken) {
|
|
31
|
-
_accessToken = accessToken;
|
|
32
|
-
}
|
|
33
|
+
_accessToken = accessToken;
|
|
33
34
|
_ci = ci;
|
|
34
35
|
exports.logger = winston_1.default.createLogger({
|
|
35
36
|
format: winston_1.format.combine(winston_1.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
|
|
@@ -37,7 +38,11 @@ function initLogger({ ci, accessToken, logFilePath, }) {
|
|
|
37
38
|
winston_1.format.metadata({
|
|
38
39
|
fillExcept: ['message', 'level', 'timestamp', 'label'],
|
|
39
40
|
})),
|
|
40
|
-
transports:
|
|
41
|
+
transports: new winston_1.default.transports.File({
|
|
42
|
+
filename: (0, env_1.getLogfilePath)({ logFilePath }),
|
|
43
|
+
level: 'debug',
|
|
44
|
+
format: winston_1.format.combine(winston_1.format.json()),
|
|
45
|
+
}),
|
|
41
46
|
});
|
|
42
47
|
return exports.logger;
|
|
43
48
|
}
|
|
@@ -50,13 +55,10 @@ function consoleLog(message) {
|
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
exports.consoleLog = consoleLog;
|
|
53
|
-
function
|
|
54
|
-
// set access token
|
|
58
|
+
function setAccessToken(accessToken) {
|
|
55
59
|
_accessToken = accessToken;
|
|
56
|
-
// set log level
|
|
57
|
-
exports.logger.level = verbose ? 'debug' : 'info';
|
|
58
60
|
}
|
|
59
|
-
exports.
|
|
61
|
+
exports.setAccessToken = setAccessToken;
|
|
60
62
|
function redactAccessToken(str) {
|
|
61
63
|
// `redactAccessToken` might be called before access token is set
|
|
62
64
|
if (_accessToken) {
|
|
@@ -64,13 +66,6 @@ function redactAccessToken(str) {
|
|
|
64
66
|
}
|
|
65
67
|
return str;
|
|
66
68
|
}
|
|
67
|
-
function getFileTransport({ logFilePath }) {
|
|
68
|
-
return new winston_1.default.transports.File({
|
|
69
|
-
filename: (0, env_1.getLogfilePath)({ logFilePath }),
|
|
70
|
-
level: 'debug',
|
|
71
|
-
format: winston_1.format.combine(winston_1.format.json()),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
69
|
// log levels:
|
|
75
70
|
// - error
|
|
76
71
|
// - warn
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const promises_1 = require("fs/promises");
|
|
4
|
+
async function init() {
|
|
5
|
+
try {
|
|
6
|
+
await (0, promises_1.writeFile)('foo.txt', 'foo', {
|
|
7
|
+
flag: 'wx',
|
|
8
|
+
mode: 0o600, // give the owner read-write privleges, no access for others
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
const a = e instanceof Error;
|
|
13
|
+
console.log(a);
|
|
14
|
+
console.log(e.constructor.name);
|
|
15
|
+
if (isErrnoError(e)) {
|
|
16
|
+
console.log(e.path);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
init();
|
|
21
|
+
function isErrnoError(error) {
|
|
22
|
+
return error instanceof Error && 'code' in error;
|
|
23
|
+
}
|
package/dist/state.d.ts
ADDED
|
File without changes
|
package/dist/state.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
7
|
-
const child_process_promisified_1 = require("../../../
|
|
7
|
+
const child_process_promisified_1 = require("../../../lib/child-process-promisified");
|
|
8
8
|
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
9
9
|
const sandbox_1 = require("../../sandbox");
|
|
10
10
|
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
@@ -50,7 +50,7 @@ describe('commit author', () => {
|
|
|
50
50
|
'--branch=production',
|
|
51
51
|
'--pr=2',
|
|
52
52
|
'--dry-run',
|
|
53
|
-
], {
|
|
53
|
+
], { cwd: sourceRepo, showOra: true });
|
|
54
54
|
const { authorEmail, authorName } = await getCommitAuthor({
|
|
55
55
|
cwd: backportRepo,
|
|
56
56
|
});
|
|
@@ -66,7 +66,7 @@ describe('commit author', () => {
|
|
|
66
66
|
'--dry-run',
|
|
67
67
|
'--gitAuthorName="Donald Duck"',
|
|
68
68
|
'--gitAuthorEmail=duck@disney.com',
|
|
69
|
-
], {
|
|
69
|
+
], { cwd: sourceRepo, showOra: true });
|
|
70
70
|
const { authorEmail, authorName } = await getCommitAuthor({
|
|
71
71
|
cwd: backportRepo,
|
|
72
72
|
});
|
|
@@ -81,7 +81,7 @@ describe('commit author', () => {
|
|
|
81
81
|
'--pr=2',
|
|
82
82
|
'--dry-run',
|
|
83
83
|
'--reset-author',
|
|
84
|
-
], {
|
|
84
|
+
], { cwd: sourceRepo, showOra: true });
|
|
85
85
|
const { authorEmail, authorName } = await getCommitAuthor({
|
|
86
86
|
cwd: backportRepo,
|
|
87
87
|
});
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const child_process_promisified_1 = require("../../../
|
|
3
|
+
const child_process_promisified_1 = require("../../../lib/child-process-promisified");
|
|
4
4
|
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
5
5
|
const sandbox_1 = require("../../sandbox");
|
|
6
6
|
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
7
7
|
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
8
8
|
describe('different-merge-strategies', () => {
|
|
9
9
|
it('list all commits regardless how they were merged', async () => {
|
|
10
|
-
const output = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
10
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
11
11
|
'--branch=foo',
|
|
12
12
|
'--repo=backport-org/different-merge-strategies',
|
|
13
13
|
`--accessToken=${accessToken}`,
|
|
14
14
|
'-n=20',
|
|
15
|
-
], { waitForString: 'Select commit' });
|
|
15
|
+
], { waitForString: 'Select commit', timeoutSeconds: 4 });
|
|
16
16
|
expect(output).toMatchInlineSnapshot(`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
"? Select commit (Use arrow keys)
|
|
18
|
+
❯ 1. Merge pull request #9 from backport-org/many-merge-commits
|
|
19
|
+
2. Merge strategy: Eighth of many merges
|
|
20
|
+
3. Merge strategy: Seventh of many merges
|
|
21
|
+
4. Merge strategy: Sixth of many merges
|
|
22
|
+
5. Merge strategy: Fifth of many merges
|
|
23
|
+
6. Merge strategy: Fourth of many merges
|
|
24
|
+
7. Merge strategy: Third of many merges
|
|
25
|
+
8. Merge strategy: Second of many merges
|
|
26
|
+
9. Merge strategy: First of many merges
|
|
27
|
+
10.Using squash to merge commits (#3) 7.x
|
|
28
|
+
11.Rebase strategy: Second commit 7.x
|
|
29
|
+
12.Rebase strategy: First commit
|
|
30
|
+
13.Merge pull request #1 from backport-org/merge-strategy
|
|
31
|
+
14.Merge strategy: Second commit
|
|
32
|
+
15.Merge strategy: First commit
|
|
33
|
+
16.Initial commit"
|
|
34
|
+
`);
|
|
35
35
|
});
|
|
36
36
|
describe('when selecting a merge commit', () => {
|
|
37
37
|
let output;
|
|
@@ -39,20 +39,22 @@ describe('different-merge-strategies', () => {
|
|
|
39
39
|
beforeAll(async () => {
|
|
40
40
|
sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
41
41
|
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
42
|
-
|
|
42
|
+
const res = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
43
43
|
'--branch=7.x',
|
|
44
44
|
'--repo=backport-org/different-merge-strategies',
|
|
45
45
|
`--accessToken=${accessToken}`,
|
|
46
46
|
`--dir=${sandboxPath}`,
|
|
47
47
|
'--pr=9',
|
|
48
48
|
'--dry-run',
|
|
49
|
-
], {
|
|
49
|
+
], { showOra: true });
|
|
50
|
+
output = res.output;
|
|
50
51
|
});
|
|
51
52
|
it('runs to completion without errors', () => {
|
|
52
53
|
expect(output).toMatchInlineSnapshot(`
|
|
53
54
|
"- Initializing...
|
|
54
55
|
? Select pull request Merge pull request #9 from backport-org/many-merge-commits
|
|
55
56
|
✔ 100% Cloning repository from github.com (one-time operation)
|
|
57
|
+
|
|
56
58
|
Backporting to 7.x:
|
|
57
59
|
- Pulling latest changes
|
|
58
60
|
✔ Pulling latest changes
|
|
@@ -88,7 +90,7 @@ describe('different-merge-strategies', () => {
|
|
|
88
90
|
`--dir=${sandboxPath}`,
|
|
89
91
|
'--pr=1',
|
|
90
92
|
'--dry-run',
|
|
91
|
-
], {
|
|
93
|
+
], { showOra: true });
|
|
92
94
|
});
|
|
93
95
|
it('backports all immediate children of the merge commit', async () => {
|
|
94
96
|
const commits = await listCommits(sandboxPath);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|