backport 6.2.1 → 6.3.0-beta
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 +13 -5
- package/dist/backportRun.d.ts +2 -2
- package/dist/backportRun.js +11 -7
- package/dist/entrypoint.cli.js +0 -0
- package/dist/entrypoint.module.js +1 -1
- package/dist/options/ConfigOptions.d.ts +2 -0
- package/dist/options/cliArgs.js +3 -2
- package/dist/options/config/config.d.ts +2 -0
- package/dist/options/config/config.js +2 -7
- package/dist/options/config/globalConfig.js +3 -3
- package/dist/options/config/readConfigFile.d.ts +2 -0
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +4 -27
- package/dist/options/options.js +37 -29
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +0 -1
- package/dist/services/HandledError.d.ts +6 -4
- package/dist/services/HandledError.js +18 -3
- package/dist/services/child-process-promisified.d.ts +3 -1
- package/dist/services/git.d.ts +22 -9
- package/dist/services/git.js +66 -54
- package/dist/services/github/commitFormatters.d.ts +0 -1
- package/dist/services/github/commitFormatters.js +1 -8
- package/dist/services/github/v3/createPullRequest.js +8 -5
- package/dist/services/github/v3/createStatusComment.js +26 -15
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
- package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
- package/dist/services/github/v4/apiRequestV4.js +38 -28
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
- package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +3 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -32
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +2 -1
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
- package/dist/services/logger.d.ts +6 -3
- package/dist/services/logger.js +11 -7
- package/dist/services/prompts.js +12 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
- package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
- package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
- package/dist/ui/getCommits.js +8 -14
- package/dist/ui/getCommitsWithoutBackports.js +6 -6
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/maybeSetupRepo.js +25 -5
- package/dist/utils/maybe.d.ts +1 -0
- package/dist/utils/maybe.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -0
- package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
- package/package.json +22 -18
- package/yarn.lock +114 -147
- package/dist/entrypoint.api.d.ts +0 -22
- package/dist/entrypoint.api.js +0 -57
- package/dist/entrypoint.api.private.test.d.ts +0 -1
- package/dist/entrypoint.api.private.test.js +0 -37
- package/dist/entrypoint.module.private.test.d.ts +0 -1
- package/dist/entrypoint.module.private.test.js +0 -37
- package/dist/index.d.ts +0 -783
- package/dist/index.js +0 -8001
- package/dist/ink.d.ts +0 -1
- package/dist/ink.js +0 -49
- package/dist/main.d.ts +0 -14
- package/dist/main.js +0 -68
- package/dist/options/cliArgs.test.d.ts +0 -1
- package/dist/options/cliArgs.test.js +0 -152
- package/dist/options/config/config.test.d.ts +0 -1
- package/dist/options/config/config.test.js +0 -48
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +0 -1
- package/dist/options/config/globalConfig.test.d.ts +0 -1
- package/dist/options/config/globalConfig.test.js +0 -80
- package/dist/options/config/projectConfig.test.d.ts +0 -1
- package/dist/options/config/projectConfig.test.js +0 -128
- package/dist/options/getValidatedOptions.d.ts +0 -49
- package/dist/options/getValidatedOptions.js +0 -45
- package/dist/options/getValidatedOptions.test.d.ts +0 -1
- package/dist/options/getValidatedOptions.test.js +0 -97
- package/dist/options/options.test.d.ts +0 -1
- package/dist/options/options.test.js +0 -338
- package/dist/options/parseRequiredOptions.d.ts +0 -71
- package/dist/options/parseRequiredOptions.js +0 -68
- package/dist/options/parseRequiredOptions.test.d.ts +0 -1
- package/dist/options/parseRequiredOptions.test.js +0 -122
- package/dist/react-components/0-loadOptions.d.ts +0 -6
- package/dist/react-components/0-loadOptions.js +0 -45
- package/dist/react-components/1-loadCommit.d.ts +0 -8
- package/dist/react-components/1-loadCommit.js +0 -88
- package/dist/react-components/1a-loadCommit.d.ts +0 -5
- package/dist/react-components/1a-loadCommit.js +0 -76
- package/dist/react-components/1b-commitChoices.d.ts +0 -5
- package/dist/react-components/1b-commitChoices.js +0 -98
- package/dist/react-components/2-commitChoices.d.ts +0 -8
- package/dist/react-components/2-commitChoices.js +0 -96
- package/dist/react-components/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/2-commitsPrompt.js +0 -96
- package/dist/react-components/2-targetBranchChoices.d.ts +0 -9
- package/dist/react-components/2-targetBranchChoices.js +0 -109
- package/dist/react-components/3-cherrypick.d.ts +0 -1
- package/dist/react-components/3-cherrypick.js +0 -2
- package/dist/react-components/App.d.ts +0 -2
- package/dist/react-components/App.js +0 -35
- package/dist/react-components/BackportStateContext.d.ts +0 -33
- package/dist/react-components/BackportStateContext.js +0 -42
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/CommitPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/getCommits.d.ts +0 -2
- package/dist/react-components/CommitPrompt/getCommits.js +0 -27
- package/dist/react-components/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt.js +0 -96
- package/dist/react-components/CustomMultiSelect.d.ts +0 -13
- package/dist/react-components/CustomMultiSelect.js +0 -21
- package/dist/react-components/CustomMultiSelectItem.d.ts +0 -5
- package/dist/react-components/CustomMultiSelectItem.js +0 -12
- package/dist/react-components/CustomSelect.d.ts +0 -14
- package/dist/react-components/CustomSelect.js +0 -34
- package/dist/react-components/ErrorBoundary.d.ts +0 -15
- package/dist/react-components/ErrorBoundary.js +0 -53
- package/dist/react-components/MultiSelect.d.ts +0 -7
- package/dist/react-components/MultiSelect.js +0 -16
- package/dist/react-components/hooks/useAsync.d.ts +0 -12
- package/dist/react-components/hooks/useAsync.js +0 -73
- package/dist/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -195
- package/dist/runWithOptions.d.ts +0 -9
- package/dist/runWithOptions.js +0 -43
- package/dist/runWithOptions.test.d.ts +0 -1
- package/dist/runWithOptions.test.js +0 -304
- package/dist/scripts/generate-gql.d.ts +0 -1
- package/dist/scripts/generate-gql.js +0 -15
- package/dist/scripts/postinstall.test.d.ts +0 -1
- package/dist/scripts/postinstall.test.js +0 -53
- package/dist/services/backportRun/backportRun.ci.d.ts +0 -6
- package/dist/services/backportRun/backportRun.ci.js +0 -81
- package/dist/services/backportRun/backportRun.d.ts +0 -14
- package/dist/services/backportRun/backportRun.interactive.d.ts +0 -1
- package/dist/services/backportRun/backportRun.interactive.js +0 -4
- package/dist/services/backportRun/backportRun.js +0 -14
- package/dist/services/backportRun/backportState.d.ts +0 -4
- package/dist/services/backportRun/backportState.js +0 -28
- package/dist/services/backportRun/getCommits.d.ts +0 -2
- package/dist/services/backportRun/getCommits.js +0 -20
- package/dist/services/backportRun/runSequentially.d.ts +0 -20
- package/dist/services/backportRun/runSequentially.js +0 -41
- package/dist/services/backportRun/runSequentially.test.d.ts +0 -1
- package/dist/services/backportRun/runSequentially.test.js +0 -199
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +0 -12
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +0 -206
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +0 -403
- package/dist/services/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -21
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- package/dist/services/getCommits.d.ts +0 -2
- package/dist/services/getCommits.js +0 -38
- package/dist/services/getCommitsWithoutBackports.d.ts +0 -11
- package/dist/services/getCommitsWithoutBackports.js +0 -68
- package/dist/services/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/services/getCommitsWithoutBackports.test.js +0 -259
- package/dist/services/getExpectedTarget.d.ts +0 -9
- package/dist/services/getExpectedTarget.js +0 -77
- package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
- package/dist/services/getExpectedTargetPullRequests.js +0 -77
- package/dist/services/getTargetBranches.d.ts +0 -5
- package/dist/services/getTargetBranches.js +0 -60
- package/dist/services/getTargetBranches.test.d.ts +0 -1
- package/dist/services/getTargetBranches.test.js +0 -180
- package/dist/services/git.integration.test.d.ts +0 -1
- package/dist/services/git.integration.test.js +0 -168
- package/dist/services/git.test.d.ts +0 -1
- package/dist/services/git.test.js +0 -503
- package/dist/services/github/commitFormatters.test.d.ts +0 -1
- package/dist/services/github/commitFormatters.test.js +0 -11
- package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
- package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/createPullRequest.test.js +0 -160
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -326
- package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
- package/dist/services/github/v4/apiRequestV4.test.js +0 -82
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
- package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
- package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
- package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitBySha.js +0 -95
- package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -78
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -134
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -200
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -131
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -85
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
- package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
- package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
- package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
- package/dist/services/github/v4/fetchProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchProjectConfig.js +0 -56
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
- package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -130
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
- package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -154
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
- package/dist/services/maybeSetupRepo.d.ts +0 -2
- package/dist/services/maybeSetupRepo.js +0 -33
- package/dist/services/maybeSetupRepo.test.d.ts +0 -1
- package/dist/services/maybeSetupRepo.test.js +0 -78
- package/dist/services/prompt.test.d.ts +0 -1
- package/dist/services/prompt.test.js +0 -87
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -237
- package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit/sourceCommit.js +0 -86
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
- package/dist/services/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit.js +0 -86
- package/dist/services/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit.test.js +0 -280
- package/dist/test/ExecError.d.ts +0 -16
- package/dist/test/ExecError.js +0 -15
- package/dist/test/backport-e2e.private.test.d.ts +0 -1
- package/dist/test/backport-e2e.private.test.js +0 -325
- package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +0 -1
- package/dist/test/handleUnbackportedPullRequests.private.test.js +0 -43
- package/dist/test/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -170
- package/dist/test/integration/createSpies.d.ts +0 -17
- package/dist/test/integration/createSpies.js +0 -85
- package/dist/test/integration/envConstants.d.ts +0 -5
- package/dist/test/integration/envConstants.js +0 -9
- package/dist/test/integration/helpers.d.ts +0 -7
- package/dist/test/integration/helpers.js +0 -31
- package/dist/test/integration/integration.private.test.d.ts +0 -1
- package/dist/test/integration/integration.private.test.js +0 -327
- package/dist/test/integration/integration.test.d.ts +0 -1
- package/dist/test/integration/integration.test.js +0 -214
- package/dist/test/mockConfigFiles.d.ts +0 -5
- package/dist/test/mockConfigFiles.js +0 -37
- package/dist/test/nockHelpers.d.ts +0 -16
- package/dist/test/nockHelpers.js +0 -32
- package/dist/test/private/getDevAccessToken.d.ts +0 -1
- package/dist/test/private/getDevAccessToken.js +0 -24
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -0
- package/dist/test/setupFiles/automatic-mocks.js +0 -43
- package/dist/todo-delete.d.ts +0 -1
- package/dist/todo-delete.js +0 -17
- package/dist/types/Commit.d.ts +0 -85
- package/dist/types/Commit.js +0 -139
- package/dist/types/PromiseReturnType.d.ts +0 -1
- package/dist/types/commitNode.d.ts +0 -89
- package/dist/types/commitNode.js +0 -139
- package/dist/types/commitNode.test.d.ts +0 -1
- package/dist/types/commitNode.test.js +0 -255
- package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
- package/dist/types/commitWithAssociatedPullRequests.js +0 -145
- package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -427
- package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/ui/getCommitsWithoutBackports.test.js +0 -259
- package/dist/ui/getTargetBranches.test.d.ts +0 -1
- package/dist/ui/getTargetBranches.test.js +0 -180
- package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
- package/dist/ui/getTargetBranchesFromLabels.js +0 -40
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
- package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
- package/dist/ui/maybeSetupRepo.test.js +0 -78
- package/dist/utils/excludeUndefined.test.d.ts +0 -1
- package/dist/utils/excludeUndefined.test.js +0 -24
- package/dist/utils/sequentially.d.ts +0 -1
- package/dist/utils/sequentially.js +0 -10
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const os_1 = __importDefault(require("os"));
|
|
26
|
-
const lodash_1 = require("lodash");
|
|
27
|
-
const nock_1 = __importDefault(require("nock"));
|
|
28
|
-
const nockHelpers_1 = require("../../test/nockHelpers");
|
|
29
|
-
const childProcess = __importStar(require("../child-process-promisified"));
|
|
30
|
-
const runSequentially_1 = require("./runSequentially");
|
|
31
|
-
jest.mock('./services/child-process-promisified', () => {
|
|
32
|
-
return {
|
|
33
|
-
exec: jest.fn(async (cmd) => {
|
|
34
|
-
throw new Error(`Mock required for exec with cmd: "${cmd}"`);
|
|
35
|
-
}),
|
|
36
|
-
execAsCallback: jest.fn((...args) => {
|
|
37
|
-
(0, lodash_1.last)(args)();
|
|
38
|
-
return {
|
|
39
|
-
stderr: {
|
|
40
|
-
on: () => null,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}),
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
describe('runSequentially', () => {
|
|
47
|
-
let rpcExecMock;
|
|
48
|
-
let rpcExecOriginalMock;
|
|
49
|
-
let res;
|
|
50
|
-
let createPullRequestCalls;
|
|
51
|
-
afterEach(() => {
|
|
52
|
-
jest.clearAllMocks();
|
|
53
|
-
nock_1.default.cleanAll();
|
|
54
|
-
});
|
|
55
|
-
beforeEach(async () => {
|
|
56
|
-
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
57
|
-
const options = {
|
|
58
|
-
accessToken: 'myAccessToken',
|
|
59
|
-
assignees: [],
|
|
60
|
-
authenticatedUsername: 'sqren_authenticated',
|
|
61
|
-
author: 'sqren',
|
|
62
|
-
autoAssign: false,
|
|
63
|
-
autoFixConflicts: undefined,
|
|
64
|
-
autoMerge: false,
|
|
65
|
-
autoMergeMethod: 'merge',
|
|
66
|
-
backportBinary: 'node scripts/backport',
|
|
67
|
-
branchLabelMapping: undefined,
|
|
68
|
-
cherrypickRef: true,
|
|
69
|
-
ci: false,
|
|
70
|
-
commitPaths: [],
|
|
71
|
-
dateSince: null,
|
|
72
|
-
dateUntil: null,
|
|
73
|
-
details: false,
|
|
74
|
-
editor: 'code',
|
|
75
|
-
fork: true,
|
|
76
|
-
gitHostname: 'github.com',
|
|
77
|
-
githubApiBaseUrlV3: 'https://api.github.com',
|
|
78
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
79
|
-
historicalBranchLabelMappings: [],
|
|
80
|
-
mainline: undefined,
|
|
81
|
-
maxNumber: 10,
|
|
82
|
-
multipleBranches: false,
|
|
83
|
-
multipleCommits: false,
|
|
84
|
-
noVerify: true,
|
|
85
|
-
prDescription: 'myPrDescription',
|
|
86
|
-
prFilter: undefined,
|
|
87
|
-
prTitle: 'myPrTitle {targetBranch} {commitMessages}',
|
|
88
|
-
publishStatusComment: true,
|
|
89
|
-
pullNumber: undefined,
|
|
90
|
-
repoName: 'kibana',
|
|
91
|
-
repoOwner: 'elastic',
|
|
92
|
-
resetAuthor: false,
|
|
93
|
-
reviewers: [],
|
|
94
|
-
sha: undefined,
|
|
95
|
-
skipRemoteConfig: undefined,
|
|
96
|
-
sourceBranch: 'my-source-branch-from-options',
|
|
97
|
-
sourcePRLabels: [],
|
|
98
|
-
targetBranches: [],
|
|
99
|
-
targetBranchChoices: [
|
|
100
|
-
{ name: '6.x' },
|
|
101
|
-
{ name: '6.0' },
|
|
102
|
-
{ name: '5.6' },
|
|
103
|
-
{ name: '5.5' },
|
|
104
|
-
{ name: '5.4' },
|
|
105
|
-
],
|
|
106
|
-
targetPRLabels: [],
|
|
107
|
-
verbose: false,
|
|
108
|
-
};
|
|
109
|
-
rpcExecMock = jest
|
|
110
|
-
.spyOn(childProcess, 'exec')
|
|
111
|
-
.mockResolvedValue({ stdout: 'success', stderr: '' });
|
|
112
|
-
rpcExecOriginalMock = jest.spyOn(childProcess, 'execAsCallback');
|
|
113
|
-
const scope = (0, nock_1.default)('https://api.github.com')
|
|
114
|
-
.post('/repos/elastic/kibana/pulls')
|
|
115
|
-
.reply(200, {
|
|
116
|
-
number: 1337,
|
|
117
|
-
html_url: 'myHtmlUrl',
|
|
118
|
-
});
|
|
119
|
-
createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
|
|
120
|
-
const commits = [
|
|
121
|
-
{
|
|
122
|
-
sha: 'abcd',
|
|
123
|
-
committedDate: '1',
|
|
124
|
-
expectedTargetPullRequests: [],
|
|
125
|
-
originalMessage: 'My commit message',
|
|
126
|
-
sourceBranch: 'master',
|
|
127
|
-
pullNumber: 55,
|
|
128
|
-
},
|
|
129
|
-
];
|
|
130
|
-
const targetBranches = ['7.x'];
|
|
131
|
-
res = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
132
|
-
scope.done();
|
|
133
|
-
});
|
|
134
|
-
it('returns pull request', () => {
|
|
135
|
-
expect(res).toEqual([
|
|
136
|
-
{
|
|
137
|
-
didUpdate: false,
|
|
138
|
-
pullRequestNumber: 1337,
|
|
139
|
-
pullRequestUrl: 'myHtmlUrl',
|
|
140
|
-
status: 'success',
|
|
141
|
-
targetBranch: '7.x',
|
|
142
|
-
},
|
|
143
|
-
]);
|
|
144
|
-
});
|
|
145
|
-
it('creates pull request', () => {
|
|
146
|
-
expect(createPullRequestCalls).toMatchInlineSnapshot(`
|
|
147
|
-
Array [
|
|
148
|
-
Object {
|
|
149
|
-
"base": "7.x",
|
|
150
|
-
"body": "# Backport
|
|
151
|
-
|
|
152
|
-
This is an automatic backport to \`7.x\` of:
|
|
153
|
-
- #55
|
|
154
|
-
|
|
155
|
-
### Questions ?
|
|
156
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
157
|
-
|
|
158
|
-
myPrDescription",
|
|
159
|
-
"head": "sqren_authenticated:backport/7.x/pr-55",
|
|
160
|
-
"title": "myPrTitle 7.x My commit message",
|
|
161
|
-
},
|
|
162
|
-
]
|
|
163
|
-
`);
|
|
164
|
-
});
|
|
165
|
-
it('should run all commands in the correct directory', () => {
|
|
166
|
-
expect(rpcExecMock.mock.calls.every(
|
|
167
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
168
|
-
([cmd, opts]) => opts.cwd === '/myHomeDir/.backport/repositories/elastic/kibana')).toBe(true);
|
|
169
|
-
});
|
|
170
|
-
it('exec should be called with correct args', () => {
|
|
171
|
-
expect(rpcExecMock).toHaveBeenCalledTimes(10);
|
|
172
|
-
expect(rpcExecMock.mock.calls.map(([cmd]) => cmd)).toEqual([
|
|
173
|
-
'git remote rm origin',
|
|
174
|
-
'git remote rm sqren_authenticated',
|
|
175
|
-
'git remote add sqren_authenticated https://x-access-token:myAccessToken@github.com/sqren_authenticated/kibana.git',
|
|
176
|
-
'git remote rm elastic',
|
|
177
|
-
'git remote add elastic https://x-access-token:myAccessToken@github.com/elastic/kibana.git',
|
|
178
|
-
'git reset --hard && git clean -d --force && git fetch elastic 7.x && git checkout -B backport/7.x/pr-55 elastic/7.x --no-track',
|
|
179
|
-
'git fetch elastic master:master --force',
|
|
180
|
-
'git cherry-pick -x abcd',
|
|
181
|
-
'git push sqren_authenticated backport/7.x/pr-55:backport/7.x/pr-55 --force',
|
|
182
|
-
'git reset --hard && git checkout my-source-branch-from-options && git branch -D backport/7.x/pr-55',
|
|
183
|
-
]);
|
|
184
|
-
});
|
|
185
|
-
it('git clone should be called with correct args', () => {
|
|
186
|
-
expect(rpcExecOriginalMock).toHaveBeenCalledTimes(1);
|
|
187
|
-
expect(rpcExecOriginalMock.mock.calls).toMatchInlineSnapshot(`
|
|
188
|
-
Array [
|
|
189
|
-
Array [
|
|
190
|
-
"git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git /myHomeDir/.backport/repositories/elastic/kibana --progress",
|
|
191
|
-
Object {
|
|
192
|
-
"maxBuffer": 104857600,
|
|
193
|
-
},
|
|
194
|
-
[Function],
|
|
195
|
-
],
|
|
196
|
-
]
|
|
197
|
-
`);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ValidConfigOptions } from '../options/options';
|
|
2
|
-
import { Commit } from '../services/sourceCommit/parseSourceCommit';
|
|
3
|
-
export declare function cherrypickAndCreateTargetPullRequest({ options, commits, targetBranch, }: {
|
|
4
|
-
options: ValidConfigOptions;
|
|
5
|
-
commits: Commit[];
|
|
6
|
-
targetBranch: string;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
url: string;
|
|
9
|
-
number: number;
|
|
10
|
-
didUpdate: boolean;
|
|
11
|
-
}>;
|
|
12
|
-
export declare function getBackportBranchName(targetBranch: string, commits: Commit[]): string;
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getBackportBranchName = exports.cherrypickAndCreateTargetPullRequest = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const lodash_1 = require("lodash");
|
|
9
|
-
const HandledError_1 = require("../services/HandledError");
|
|
10
|
-
const child_process_promisified_1 = require("../services/child-process-promisified");
|
|
11
|
-
const env_1 = require("../services/env");
|
|
12
|
-
const git_1 = require("../services/git");
|
|
13
|
-
const commitFormatters_1 = require("../services/github/commitFormatters");
|
|
14
|
-
const addAssigneesToPullRequest_1 = require("../services/github/v3/addAssigneesToPullRequest");
|
|
15
|
-
const addLabelsToPullRequest_1 = require("../services/github/v3/addLabelsToPullRequest");
|
|
16
|
-
const addReviewersToPullRequest_1 = require("../services/github/v3/addReviewersToPullRequest");
|
|
17
|
-
const createPullRequest_1 = require("../services/github/v3/createPullRequest");
|
|
18
|
-
const enablePullRequestAutoMerge_1 = require("../services/github/v4/enablePullRequestAutoMerge");
|
|
19
|
-
const logger_1 = require("../services/logger");
|
|
20
|
-
const prompts_1 = require("../services/prompts");
|
|
21
|
-
const sequentially_1 = require("../utils/sequentially");
|
|
22
|
-
const getCommitsWithoutBackports_1 = require("./getCommitsWithoutBackports");
|
|
23
|
-
async function cherrypickAndCreateTargetPullRequest({ options, commits, targetBranch, }) {
|
|
24
|
-
const backportBranch = getBackportBranchName(targetBranch, commits);
|
|
25
|
-
const repoForkOwner = (0, git_1.getRepoForkOwner)(options);
|
|
26
|
-
(0, logger_1.consoleLog)(`\n${chalk_1.default.bold(`Backporting to ${targetBranch}:`)}`);
|
|
27
|
-
const prPayload = {
|
|
28
|
-
owner: options.repoOwner,
|
|
29
|
-
repo: options.repoName,
|
|
30
|
-
title: (0, createPullRequest_1.getTitle)({ options, commits, targetBranch }),
|
|
31
|
-
body: (0, createPullRequest_1.getPullRequestBody)({ options, commits, targetBranch }),
|
|
32
|
-
head: `${repoForkOwner}:${backportBranch}`,
|
|
33
|
-
base: targetBranch, // eg. 7.x
|
|
34
|
-
};
|
|
35
|
-
const targetPullRequest = await backportViaFilesystem({
|
|
36
|
-
options,
|
|
37
|
-
prPayload,
|
|
38
|
-
targetBranch,
|
|
39
|
-
backportBranch,
|
|
40
|
-
commits,
|
|
41
|
-
});
|
|
42
|
-
// add assignees to target pull request
|
|
43
|
-
const assignees = options.autoAssign
|
|
44
|
-
? [options.authenticatedUsername]
|
|
45
|
-
: options.assignees;
|
|
46
|
-
if (options.assignees.length > 0) {
|
|
47
|
-
await (0, addAssigneesToPullRequest_1.addAssigneesToPullRequest)(options, targetPullRequest.number, assignees);
|
|
48
|
-
}
|
|
49
|
-
// add reviewers to target pull request
|
|
50
|
-
if (options.reviewers.length > 0) {
|
|
51
|
-
await (0, addReviewersToPullRequest_1.addReviewersToPullRequest)(options, targetPullRequest.number, options.reviewers);
|
|
52
|
-
}
|
|
53
|
-
// add labels to target pull request
|
|
54
|
-
if (options.targetPRLabels.length > 0) {
|
|
55
|
-
await (0, addLabelsToPullRequest_1.addLabelsToPullRequest)(options, targetPullRequest.number, options.targetPRLabels);
|
|
56
|
-
}
|
|
57
|
-
// make PR auto mergable
|
|
58
|
-
if (options.autoMerge) {
|
|
59
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)(options, targetPullRequest.number);
|
|
60
|
-
}
|
|
61
|
-
// add labels to source pull requests
|
|
62
|
-
if (options.sourcePRLabels.length > 0) {
|
|
63
|
-
const promises = commits.map((commit) => {
|
|
64
|
-
if (commit.pullNumber) {
|
|
65
|
-
return (0, addLabelsToPullRequest_1.addLabelsToPullRequest)(options, commit.pullNumber, options.sourcePRLabels);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
await Promise.all(promises);
|
|
69
|
-
}
|
|
70
|
-
(0, logger_1.consoleLog)(`View pull request: ${targetPullRequest.url}`);
|
|
71
|
-
return targetPullRequest;
|
|
72
|
-
}
|
|
73
|
-
exports.cherrypickAndCreateTargetPullRequest = cherrypickAndCreateTargetPullRequest;
|
|
74
|
-
async function backportViaFilesystem({ options, prPayload, commits, targetBranch, backportBranch, }) {
|
|
75
|
-
logger_1.logger.info('Backporting via filesystem');
|
|
76
|
-
await (0, git_1.createBackportBranch)({ options, targetBranch, backportBranch });
|
|
77
|
-
await (0, sequentially_1.sequentially)(commits, (commit) => waitForCherrypick(options, commit, targetBranch));
|
|
78
|
-
if (options.resetAuthor) {
|
|
79
|
-
await (0, git_1.setCommitAuthor)(options, options.authenticatedUsername);
|
|
80
|
-
}
|
|
81
|
-
await (0, git_1.pushBackportBranch)({ options, backportBranch });
|
|
82
|
-
await (0, git_1.deleteBackportBranch)({ options, backportBranch });
|
|
83
|
-
return (0, createPullRequest_1.createPullRequest)({ options, prPayload });
|
|
84
|
-
}
|
|
85
|
-
/*
|
|
86
|
-
* Returns the name of the backport branch without remote name
|
|
87
|
-
*
|
|
88
|
-
* Examples:
|
|
89
|
-
* For a single PR: `backport/7.x/pr-1234`
|
|
90
|
-
* For a single commit: `backport/7.x/commit-abcdef`
|
|
91
|
-
* For multiple: `backport/7.x/pr-1234_commit-abcdef`
|
|
92
|
-
*/
|
|
93
|
-
function getBackportBranchName(targetBranch, commits) {
|
|
94
|
-
const refValues = commits
|
|
95
|
-
.map((commit) => commit.pullNumber
|
|
96
|
-
? `pr-${commit.pullNumber}`
|
|
97
|
-
: `commit-${(0, commitFormatters_1.getShortSha)(commit.sha)}`)
|
|
98
|
-
.join('_')
|
|
99
|
-
.slice(0, 200);
|
|
100
|
-
return `backport/${targetBranch}/${refValues}`;
|
|
101
|
-
}
|
|
102
|
-
exports.getBackportBranchName = getBackportBranchName;
|
|
103
|
-
async function waitForCherrypick(options, commit, targetBranch) {
|
|
104
|
-
const spinnerText = `Cherry-picking: ${chalk_1.default.greenBright((0, commitFormatters_1.getFirstLine)(commit.originalMessage))}`;
|
|
105
|
-
const mergedTargetPullRequest = commit.expectedTargetPullRequests.find((pr) => pr.state === 'MERGED' && pr.branch === targetBranch);
|
|
106
|
-
await (0, git_1.fetchBranch)(options, commit.sourceBranch);
|
|
107
|
-
const { conflictingFiles, unstagedFiles, needsResolving } = await (0, git_1.cherrypick)(options, commit.sha, mergedTargetPullRequest);
|
|
108
|
-
// no conflicts encountered
|
|
109
|
-
if (!needsResolving) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
// resolve conflicts automatically
|
|
113
|
-
if (options.autoFixConflicts) {
|
|
114
|
-
// const autoResolveSpinner = ora(
|
|
115
|
-
// 'Attempting to resolve conflicts automatically'
|
|
116
|
-
// ).start();
|
|
117
|
-
const repoPath = (0, env_1.getRepoPath)(options);
|
|
118
|
-
const didAutoFix = await options.autoFixConflicts({
|
|
119
|
-
files: conflictingFiles.map((f) => f.absolute),
|
|
120
|
-
directory: repoPath,
|
|
121
|
-
logger: logger_1.logger,
|
|
122
|
-
targetBranch,
|
|
123
|
-
});
|
|
124
|
-
// conflicts were automatically resolved
|
|
125
|
-
if (didAutoFix) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const commitsWithoutBackports = await (0, getCommitsWithoutBackports_1.getCommitsWithoutBackports)({
|
|
130
|
-
options,
|
|
131
|
-
commit,
|
|
132
|
-
targetBranch,
|
|
133
|
-
conflictingFiles: conflictingFiles.map((f) => f.relative).slice(0, 50),
|
|
134
|
-
});
|
|
135
|
-
if (options.ci) {
|
|
136
|
-
throw new HandledError_1.HandledError(`Commit could not be cherrypicked due to conflicts`, {
|
|
137
|
-
type: 'merge-conflict-due-to-missing-backports',
|
|
138
|
-
commitsWithoutBackports,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
(0, logger_1.consoleLog)(chalk_1.default.bold('\nThe commit could not be backported due to conflicts\n'));
|
|
142
|
-
if (commitsWithoutBackports.length > 0) {
|
|
143
|
-
(0, logger_1.consoleLog)(chalk_1.default.italic(`Hint: Before fixing the conflicts manually you should consider backporting the following pull requests to "${targetBranch}":`));
|
|
144
|
-
(0, logger_1.consoleLog)(`${commitsWithoutBackports.map((c) => c.formatted).join('\n')}\n\n`);
|
|
145
|
-
}
|
|
146
|
-
/*
|
|
147
|
-
* Commit could not be cleanly cherrypicked: Initiating conflict resolution
|
|
148
|
-
*/
|
|
149
|
-
if (options.editor) {
|
|
150
|
-
const repoPath = (0, env_1.getRepoPath)(options);
|
|
151
|
-
await (0, child_process_promisified_1.exec)(`${options.editor} ${repoPath}`, {});
|
|
152
|
-
}
|
|
153
|
-
// list files with conflict markers + unstaged files and require user to resolve them
|
|
154
|
-
await listConflictingAndUnstagedFiles({
|
|
155
|
-
retries: 0,
|
|
156
|
-
options,
|
|
157
|
-
conflictingFiles: conflictingFiles.map((f) => f.absolute),
|
|
158
|
-
unstagedFiles,
|
|
159
|
-
});
|
|
160
|
-
// Conflicts should be resolved and files staged at this point
|
|
161
|
-
// const stagingSpinner = ora(`Finalizing cherrypick`).start();
|
|
162
|
-
// Run `git commit`
|
|
163
|
-
await (0, git_1.commitChanges)(commit, options);
|
|
164
|
-
}
|
|
165
|
-
async function listConflictingAndUnstagedFiles({ retries, options, conflictingFiles, unstagedFiles, }) {
|
|
166
|
-
const hasUnstagedFiles = !(0, lodash_1.isEmpty)((0, lodash_1.difference)(unstagedFiles, conflictingFiles));
|
|
167
|
-
const hasConflictingFiles = !(0, lodash_1.isEmpty)(conflictingFiles);
|
|
168
|
-
if (!hasConflictingFiles && !hasUnstagedFiles) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
// add divider between prompts
|
|
172
|
-
if (retries > 0) {
|
|
173
|
-
(0, logger_1.consoleLog)('\n----------------------------------------\n');
|
|
174
|
-
}
|
|
175
|
-
const header = chalk_1.default.reset(`Fix the following conflicts manually:`);
|
|
176
|
-
// show conflict section if there are conflicting files
|
|
177
|
-
const conflictSection = hasConflictingFiles
|
|
178
|
-
? `Conflicting files:\n${chalk_1.default.reset(conflictingFiles.map((file) => ` - ${file}`).join('\n'))}`
|
|
179
|
-
: '';
|
|
180
|
-
const unstagedSection = hasUnstagedFiles
|
|
181
|
-
? `Unstaged files:\n${chalk_1.default.reset(unstagedFiles.map((file) => ` - ${file}`).join('\n'))}`
|
|
182
|
-
: '';
|
|
183
|
-
const res = await (0, prompts_1.confirmPrompt)(`${header}
|
|
184
|
-
|
|
185
|
-
${conflictSection}
|
|
186
|
-
${unstagedSection}
|
|
187
|
-
|
|
188
|
-
Press ENTER when the conflicts are resolved and files are staged`);
|
|
189
|
-
if (!res) {
|
|
190
|
-
throw new HandledError_1.HandledError('Aborted');
|
|
191
|
-
}
|
|
192
|
-
const MAX_RETRIES = 100;
|
|
193
|
-
if (retries++ > MAX_RETRIES) {
|
|
194
|
-
throw new Error(`Maximum number of retries (${MAX_RETRIES}) exceeded`);
|
|
195
|
-
}
|
|
196
|
-
const [_conflictingFiles, _unstagedFiles] = await Promise.all([
|
|
197
|
-
(0, git_1.getConflictingFiles)(options),
|
|
198
|
-
(0, git_1.getUnstagedFiles)(options),
|
|
199
|
-
]);
|
|
200
|
-
await listConflictingAndUnstagedFiles({
|
|
201
|
-
retries,
|
|
202
|
-
options,
|
|
203
|
-
conflictingFiles: _conflictingFiles.map((file) => file.absolute),
|
|
204
|
-
unstagedFiles: _unstagedFiles,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|