backport 6.1.4 → 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 +53 -42
- package/dist/{main.d.ts → backportRun.d.ts} +3 -3
- package/dist/{main.js → backportRun.js} +24 -9
- package/dist/entrypoint.cli.js +3 -5
- package/dist/entrypoint.module.d.ts +4 -3
- package/dist/entrypoint.module.js +9 -7
- package/dist/options/ConfigOptions.d.ts +6 -0
- package/dist/options/cliArgs.d.ts +17 -13
- package/dist/options/cliArgs.js +25 -6
- package/dist/options/config/config.d.ts +12 -1
- package/dist/options/config/config.js +8 -7
- package/dist/options/config/globalConfig.d.ts +2 -2
- package/dist/options/config/globalConfig.js +18 -16
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/readConfigFile.d.ts +28 -22
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +19 -37
- package/dist/options/options.js +44 -31
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +0 -1
- package/dist/scripts/postinstall.js +3 -3
- 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/env.d.ts +5 -4
- package/dist/services/env.js +13 -11
- 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 +16 -10
- package/dist/services/github/v3/createStatusComment.d.ts +1 -1
- package/dist/services/github/v3/createStatusComment.js +34 -18
- 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/{fetchProjectConfig.d.ts → fetchRemoteProjectConfig.d.ts} +1 -1
- package/dist/services/github/v4/{fetchProjectConfig.js → fetchRemoteProjectConfig.js} +3 -3
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +7 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -39
- 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 +9 -4
- package/dist/services/logger.js +40 -37
- 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 +13 -14
- 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 +24 -10
- 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/dist/utils/redact.d.ts +1 -0
- package/dist/utils/redact.js +7 -0
- package/package.json +24 -20
- package/yarn.lock +160 -237
- 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/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 -22
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/config/globalConfig.test.d.ts +0 -1
- package/dist/options/config/globalConfig.test.js +0 -74
- package/dist/options/config/projectConfig.test.d.ts +0 -1
- package/dist/options/config/projectConfig.test.js +0 -99
- 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 -335
- 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/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -199
- 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/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -27
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- 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/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 -110
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -291
- 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.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/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/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/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -168
- 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/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 -432
- 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 -74
- package/dist/utils/excludeUndefined.test.d.ts +0 -1
- package/dist/utils/excludeUndefined.test.js +0 -24
|
@@ -4,10 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getProjectConfig = void 0;
|
|
7
|
+
const posix_1 = __importDefault(require("path/posix"));
|
|
7
8
|
const find_up_1 = __importDefault(require("find-up"));
|
|
8
9
|
const readConfigFile_1 = require("../config/readConfigFile");
|
|
9
|
-
async function getProjectConfig() {
|
|
10
|
-
const filepath =
|
|
10
|
+
async function getProjectConfig({ configFile, }) {
|
|
11
|
+
const filepath = configFile
|
|
12
|
+
? posix_1.default.resolve(configFile)
|
|
13
|
+
: await (0, find_up_1.default)('.backportrc.json');
|
|
11
14
|
if (!filepath) {
|
|
12
15
|
return;
|
|
13
16
|
}
|
|
@@ -2,53 +2,59 @@ import { ConfigFileOptions } from '../ConfigOptions';
|
|
|
2
2
|
export declare function readConfigFile(filepath: string): Promise<ConfigFileOptions>;
|
|
3
3
|
export declare function withConfigMigrations({ upstream, labels, branches, ...config }: ConfigFileOptions): {
|
|
4
4
|
fork?: boolean | undefined;
|
|
5
|
+
dir?: string | undefined;
|
|
6
|
+
help?: boolean | undefined;
|
|
5
7
|
verbose?: boolean | undefined;
|
|
6
8
|
accessToken?: string | undefined;
|
|
7
|
-
assignees?: string[] | undefined;
|
|
8
9
|
author?: string | null | undefined;
|
|
9
10
|
autoAssign?: boolean | undefined;
|
|
10
|
-
|
|
11
|
-
files: string[];
|
|
12
|
-
directory: string;
|
|
13
|
-
logger: {
|
|
14
|
-
error: (message: string, meta?: unknown) => void;
|
|
15
|
-
warn: (message: string, meta?: unknown) => void;
|
|
16
|
-
info: (message: string, meta?: unknown) => void;
|
|
17
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
18
|
-
debug: (message: string, meta?: unknown) => void;
|
|
19
|
-
};
|
|
20
|
-
targetBranch: string;
|
|
21
|
-
}) => boolean | Promise<boolean>) | undefined;
|
|
11
|
+
assignees?: string[] | undefined;
|
|
22
12
|
autoMerge?: boolean | undefined;
|
|
23
13
|
autoMergeMethod?: string | undefined;
|
|
24
|
-
backportBinary?: string | undefined;
|
|
25
|
-
cherrypickRef?: boolean | undefined;
|
|
26
14
|
ci?: boolean | undefined;
|
|
27
|
-
|
|
15
|
+
cherrypickRef?: boolean | undefined;
|
|
16
|
+
configFile?: string | undefined;
|
|
28
17
|
details?: boolean | undefined;
|
|
29
18
|
editor?: string | undefined;
|
|
19
|
+
skipRemoteConfig?: boolean | undefined;
|
|
30
20
|
gitHostname?: string | undefined;
|
|
31
21
|
githubApiBaseUrlV3?: string | undefined;
|
|
32
22
|
githubApiBaseUrlV4?: string | undefined;
|
|
23
|
+
logFilePath?: string | undefined;
|
|
33
24
|
maxNumber?: number | undefined;
|
|
34
25
|
multiple?: boolean | undefined;
|
|
35
26
|
multipleBranches?: boolean | undefined;
|
|
36
27
|
multipleCommits?: boolean | undefined;
|
|
37
28
|
noVerify?: boolean | undefined;
|
|
38
29
|
prDescription?: string | undefined;
|
|
39
|
-
prFilter?: string | undefined;
|
|
40
30
|
prTitle?: string | undefined;
|
|
31
|
+
prFilter?: string | undefined;
|
|
41
32
|
pullNumber?: number | undefined;
|
|
42
|
-
repoName?: string | undefined;
|
|
43
|
-
repoOwner?: string | undefined;
|
|
44
|
-
resetAuthor?: boolean | undefined;
|
|
45
|
-
reviewers?: string[] | undefined;
|
|
46
33
|
sha?: string | undefined;
|
|
47
|
-
|
|
34
|
+
resetAuthor?: boolean | undefined;
|
|
35
|
+
repoOwner?: string | undefined;
|
|
36
|
+
repoName?: string | undefined;
|
|
48
37
|
sourceBranch?: string | undefined;
|
|
38
|
+
version?: boolean | undefined;
|
|
39
|
+
commitPaths?: string[] | undefined;
|
|
40
|
+
reviewers?: string[] | undefined;
|
|
49
41
|
sourcePRLabels?: string[] | undefined;
|
|
50
42
|
targetBranchChoices?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
51
43
|
targetBranches?: string[] | undefined;
|
|
52
44
|
targetPRLabels?: string[] | undefined;
|
|
45
|
+
publishStatusComment?: boolean | undefined;
|
|
46
|
+
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
47
|
+
files: string[];
|
|
48
|
+
directory: string;
|
|
49
|
+
logger: {
|
|
50
|
+
error: (message: string, meta?: unknown) => void;
|
|
51
|
+
warn: (message: string, meta?: unknown) => void;
|
|
52
|
+
info: (message: string, meta?: unknown) => void;
|
|
53
|
+
verbose: (message: string, meta?: unknown) => void;
|
|
54
|
+
debug: (message: string, meta?: unknown) => void;
|
|
55
|
+
};
|
|
56
|
+
targetBranch: string;
|
|
57
|
+
}) => boolean | Promise<boolean>) | undefined;
|
|
58
|
+
backportBinary?: string | undefined;
|
|
53
59
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
54
60
|
};
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.withConfigMigrations = exports.readConfigFile = void 0;
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
7
8
|
const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
8
9
|
const HandledError_1 = require("../../services/HandledError");
|
|
9
|
-
const fs_promisified_1 = require("../../services/fs-promisified");
|
|
10
10
|
const excludeUndefined_1 = require("../../utils/excludeUndefined");
|
|
11
11
|
async function readConfigFile(filepath) {
|
|
12
|
-
const fileContents = await (0,
|
|
12
|
+
const fileContents = await (0, promises_1.readFile)(filepath, 'utf8');
|
|
13
13
|
const configWithoutComments = (0, strip_json_comments_1.default)(fileContents);
|
|
14
14
|
try {
|
|
15
15
|
return withConfigMigrations(JSON.parse(configWithoutComments));
|
|
@@ -1,69 +1,48 @@
|
|
|
1
1
|
import { ConfigFileOptions, TargetBranchChoiceOrString } from './ConfigOptions';
|
|
2
2
|
export declare type ValidConfigOptions = Readonly<Awaited<ReturnType<typeof getOptions>>>;
|
|
3
|
-
export declare
|
|
4
|
-
assignees: string[];
|
|
5
|
-
autoAssign: boolean;
|
|
6
|
-
autoMerge: boolean;
|
|
7
|
-
autoMergeMethod: string;
|
|
8
|
-
backportBinary: string;
|
|
9
|
-
cherrypickRef: boolean;
|
|
10
|
-
ci: boolean;
|
|
11
|
-
commitPaths: string[];
|
|
12
|
-
dateSince: null;
|
|
13
|
-
dateUntil: null;
|
|
14
|
-
details: boolean;
|
|
15
|
-
fork: boolean;
|
|
16
|
-
maxNumber: number;
|
|
17
|
-
multipleBranches: boolean;
|
|
18
|
-
multipleCommits: boolean;
|
|
19
|
-
noVerify: boolean;
|
|
20
|
-
resetAuthor: boolean;
|
|
21
|
-
reviewers: string[];
|
|
22
|
-
sourcePRLabels: string[];
|
|
23
|
-
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
24
|
-
targetBranches: string[];
|
|
25
|
-
targetPRLabels: string[];
|
|
26
|
-
verbose: boolean;
|
|
27
|
-
};
|
|
28
|
-
export declare function getOptions(argv: string[], optionsFromModule?: ConfigFileOptions): Promise<{
|
|
3
|
+
export declare function getOptions(processArgs: string[], optionsFromModule: ConfigFileOptions): Promise<{
|
|
29
4
|
accessToken: string;
|
|
30
5
|
repoName: string;
|
|
31
6
|
repoOwner: string;
|
|
32
7
|
fork: boolean;
|
|
8
|
+
dir?: string | undefined;
|
|
33
9
|
verbose: boolean;
|
|
34
|
-
assignees: string[];
|
|
35
10
|
author: string | null;
|
|
36
11
|
autoAssign: boolean;
|
|
12
|
+
assignees: string[];
|
|
37
13
|
autoMerge: boolean;
|
|
38
14
|
autoMergeMethod: string;
|
|
39
|
-
cherrypickRef: boolean;
|
|
40
15
|
ci: boolean;
|
|
41
|
-
|
|
16
|
+
cherrypickRef: boolean;
|
|
17
|
+
configFile?: string | undefined;
|
|
42
18
|
details: boolean;
|
|
43
19
|
editor?: string | undefined;
|
|
44
|
-
|
|
20
|
+
skipRemoteConfig?: boolean | undefined;
|
|
21
|
+
gitHostname: string;
|
|
45
22
|
githubApiBaseUrlV3?: string | undefined;
|
|
46
23
|
githubApiBaseUrlV4?: string | undefined;
|
|
24
|
+
logFilePath?: string | undefined;
|
|
25
|
+
mainline?: number | undefined;
|
|
47
26
|
maxNumber: number;
|
|
48
27
|
multipleBranches: boolean;
|
|
49
28
|
multipleCommits: boolean;
|
|
50
29
|
noVerify: boolean;
|
|
51
30
|
prDescription?: string | undefined;
|
|
52
|
-
prFilter?: string | undefined;
|
|
53
31
|
prTitle?: string | undefined;
|
|
32
|
+
prFilter?: string | undefined;
|
|
54
33
|
pullNumber?: number | undefined;
|
|
55
|
-
resetAuthor: boolean;
|
|
56
|
-
reviewers: string[];
|
|
57
34
|
sha?: string | undefined;
|
|
58
|
-
|
|
35
|
+
resetAuthor: boolean;
|
|
59
36
|
sourceBranch: string;
|
|
37
|
+
dateSince: string | null;
|
|
38
|
+
dateUntil: string | null;
|
|
39
|
+
commitPaths: string[];
|
|
40
|
+
reviewers: string[];
|
|
60
41
|
sourcePRLabels: string[];
|
|
61
42
|
targetBranchChoices: string[] | TargetBranchChoiceOrString[];
|
|
62
43
|
targetBranches: string[];
|
|
63
44
|
targetPRLabels: string[];
|
|
64
|
-
|
|
65
|
-
dateSince: string | null;
|
|
66
|
-
dateUntil: string | null;
|
|
45
|
+
publishStatusComment: boolean;
|
|
67
46
|
historicalBranchLabelMappings: {
|
|
68
47
|
branchLabelMapping: Record<string, string>;
|
|
69
48
|
committedDate: string;
|
|
@@ -82,9 +61,12 @@ export declare function getOptions(argv: string[], optionsFromModule?: ConfigFil
|
|
|
82
61
|
}) => boolean | Promise<boolean>) | undefined;
|
|
83
62
|
backportBinary: string;
|
|
84
63
|
multiple?: boolean | undefined;
|
|
64
|
+
help?: boolean | undefined;
|
|
65
|
+
version?: boolean | undefined;
|
|
85
66
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
86
67
|
upstream?: string | undefined;
|
|
87
68
|
branches?: TargetBranchChoiceOrString[] | undefined;
|
|
88
69
|
labels?: string[] | undefined;
|
|
89
70
|
authenticatedUsername: string;
|
|
71
|
+
cwd: string;
|
|
90
72
|
}>;
|
package/dist/options/options.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOptions =
|
|
3
|
+
exports.getOptions = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const HandledError_1 = require("../services/HandledError");
|
|
6
6
|
const env_1 = require("../services/env");
|
|
7
7
|
const getOptionsFromGithub_1 = require("../services/github/v4/getOptionsFromGithub/getOptionsFromGithub");
|
|
8
|
+
const getRepoOwnerAndNameFromGitRemotes_1 = require("../services/github/v4/getRepoOwnerAndNameFromGitRemotes");
|
|
8
9
|
const logger_1 = require("./../services/logger");
|
|
9
10
|
const cliArgs_1 = require("./cliArgs");
|
|
10
11
|
const config_1 = require("./config/config");
|
|
11
12
|
const PROJECT_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson';
|
|
12
13
|
const GLOBAL_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/main/docs/configuration.md#global-config-backportconfigjson';
|
|
13
|
-
|
|
14
|
+
const defaultConfigOptions = {
|
|
14
15
|
assignees: [],
|
|
15
16
|
autoAssign: false,
|
|
16
17
|
autoMerge: false,
|
|
@@ -19,14 +20,17 @@ exports.defaultConfigOptions = {
|
|
|
19
20
|
cherrypickRef: true,
|
|
20
21
|
ci: false,
|
|
21
22
|
commitPaths: [],
|
|
23
|
+
cwd: process.cwd(),
|
|
22
24
|
dateSince: null,
|
|
23
25
|
dateUntil: null,
|
|
24
26
|
details: false,
|
|
25
27
|
fork: true,
|
|
28
|
+
gitHostname: 'github.com',
|
|
26
29
|
maxNumber: 10,
|
|
27
30
|
multipleBranches: true,
|
|
28
31
|
multipleCommits: false,
|
|
29
32
|
noVerify: true,
|
|
33
|
+
publishStatusComment: true,
|
|
30
34
|
resetAuthor: false,
|
|
31
35
|
reviewers: [],
|
|
32
36
|
sourcePRLabels: [],
|
|
@@ -35,23 +39,24 @@ exports.defaultConfigOptions = {
|
|
|
35
39
|
targetPRLabels: [],
|
|
36
40
|
verbose: false,
|
|
37
41
|
};
|
|
38
|
-
async function getOptions(
|
|
39
|
-
const
|
|
40
|
-
const
|
|
42
|
+
async function getOptions(processArgs, optionsFromModule) {
|
|
43
|
+
const optionsFromCliArgs = (0, cliArgs_1.getOptionsFromCliArgs)(processArgs);
|
|
44
|
+
const optionsFromConfigFiles = await (0, config_1.getOptionsFromConfigFiles)({
|
|
45
|
+
optionsFromCliArgs,
|
|
46
|
+
optionsFromModule,
|
|
47
|
+
defaultConfigOptions,
|
|
48
|
+
});
|
|
41
49
|
// combined options from cli and config files
|
|
42
50
|
const combined = getCombinedOptions({
|
|
43
51
|
optionsFromConfigFiles,
|
|
44
52
|
optionsFromCliArgs,
|
|
45
53
|
});
|
|
54
|
+
const { accessToken, repoName, repoOwner } = await getRequiredOptions(combined);
|
|
46
55
|
// update logger
|
|
47
|
-
(0, logger_1.updateLogger)(combined);
|
|
48
|
-
// required
|
|
49
|
-
const accessToken = requireAccessToken(combined);
|
|
50
|
-
const repoName = requireRepoName(combined);
|
|
51
|
-
const repoOwner = requireRepoOwner(combined);
|
|
56
|
+
(0, logger_1.updateLogger)({ accessToken, verbose: combined.verbose });
|
|
52
57
|
const optionsFromGithub = await (0, getOptionsFromGithub_1.getOptionsFromGithub)({
|
|
53
58
|
...combined,
|
|
54
|
-
// required
|
|
59
|
+
// required options
|
|
55
60
|
accessToken,
|
|
56
61
|
repoName,
|
|
57
62
|
repoOwner,
|
|
@@ -60,7 +65,7 @@ async function getOptions(argv, optionsFromModule) {
|
|
|
60
65
|
// default author
|
|
61
66
|
author: optionsFromGithub.authenticatedUsername,
|
|
62
67
|
// default values have lowest precedence
|
|
63
|
-
...
|
|
68
|
+
...defaultConfigOptions,
|
|
64
69
|
// local config options override default options
|
|
65
70
|
...optionsFromConfigFiles,
|
|
66
71
|
// remote config options override local config options
|
|
@@ -76,32 +81,40 @@ async function getOptions(argv, optionsFromModule) {
|
|
|
76
81
|
return res;
|
|
77
82
|
}
|
|
78
83
|
exports.getOptions = getOptions;
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function requireAccessToken(combinedOptions) {
|
|
87
|
-
// accessToken must be supplied in config or via cli args
|
|
88
|
-
if (!combinedOptions.accessToken) {
|
|
84
|
+
async function getRequiredOptions(combined) {
|
|
85
|
+
const { accessToken, repoName, repoOwner } = combined;
|
|
86
|
+
if (accessToken && repoName && repoOwner) {
|
|
87
|
+
return { accessToken, repoName, repoOwner };
|
|
88
|
+
}
|
|
89
|
+
// require access token
|
|
90
|
+
if (!accessToken) {
|
|
89
91
|
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
90
92
|
throw new HandledError_1.HandledError(`Please update your config file: "${globalConfigPath}".\nIt must contain a valid "accessToken".\n\nRead more: ${GLOBAL_CONFIG_DOCS_LINK}`);
|
|
91
93
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
// attempt to retrieve repo-owner and repo-name from git remote
|
|
95
|
+
const gitRemote = await (0, getRepoOwnerAndNameFromGitRemotes_1.getRepoOwnerAndNameFromGitRemotes)({
|
|
96
|
+
cwd: combined.cwd,
|
|
97
|
+
githubApiBaseUrlV4: combined.githubApiBaseUrlV4,
|
|
98
|
+
accessToken,
|
|
99
|
+
});
|
|
100
|
+
if (!gitRemote.repoName) {
|
|
96
101
|
throw new HandledError_1.HandledError(`Please specify a repo name: "--repo-name kibana".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
97
102
|
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
function requireRepoOwner(combinedOptions) {
|
|
101
|
-
if (!combinedOptions.repoOwner) {
|
|
103
|
+
if (!gitRemote.repoOwner) {
|
|
102
104
|
throw new HandledError_1.HandledError(`Please specify a repo owner: "--repo-owner elastic".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
103
105
|
}
|
|
104
|
-
return
|
|
106
|
+
return {
|
|
107
|
+
accessToken,
|
|
108
|
+
repoName: gitRemote.repoName,
|
|
109
|
+
repoOwner: gitRemote.repoOwner,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function getCombinedOptions({ optionsFromConfigFiles, optionsFromCliArgs, }) {
|
|
113
|
+
return {
|
|
114
|
+
...defaultConfigOptions,
|
|
115
|
+
...optionsFromConfigFiles,
|
|
116
|
+
...optionsFromCliArgs,
|
|
117
|
+
};
|
|
105
118
|
}
|
|
106
119
|
function requireTargetBranch(config) {
|
|
107
120
|
// ensure `targetBranches` or `targetBranchChoices` are given
|
package/dist/runSequentially.js
CHANGED
|
@@ -6,10 +6,10 @@ const env_1 = require("../services/env");
|
|
|
6
6
|
const logger_1 = require("../services/logger");
|
|
7
7
|
async function postinstall() {
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
9
|
+
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
10
|
+
const didCreate = await (0, globalConfig_1.createGlobalConfigAndFolderIfNotExist)(globalConfigPath);
|
|
10
11
|
if (didCreate) {
|
|
11
|
-
|
|
12
|
-
(0, logger_1.consoleLog)(`Global config successfully created in ${GLOBAL_CONFIG_PATH}`);
|
|
12
|
+
(0, logger_1.consoleLog)(`Global config successfully created in ${globalConfigPath}`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
catch (e) {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Commit } from './sourceCommit/parseSourceCommit';
|
|
2
|
-
declare type
|
|
3
|
-
|
|
2
|
+
declare type ErrorContext = {
|
|
3
|
+
code: 'merge-conflict-exception';
|
|
4
4
|
commitsWithoutBackports: {
|
|
5
5
|
formatted: string;
|
|
6
6
|
commit: Commit;
|
|
7
7
|
}[];
|
|
8
|
+
} | {
|
|
9
|
+
code: 'no-branches-exception' | 'abort-exception';
|
|
8
10
|
};
|
|
9
11
|
export declare class HandledError extends Error {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
+
errorContext?: ErrorContext;
|
|
13
|
+
constructor(errorContext: ErrorContext | string);
|
|
12
14
|
}
|
|
13
15
|
export {};
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HandledError = void 0;
|
|
4
|
+
function getMessage(errorContext) {
|
|
5
|
+
if (typeof errorContext === 'string') {
|
|
6
|
+
return errorContext;
|
|
7
|
+
}
|
|
8
|
+
switch (errorContext.code) {
|
|
9
|
+
case 'merge-conflict-exception':
|
|
10
|
+
return `Commit could not be cherrypicked due to conflicts`;
|
|
11
|
+
case 'no-branches-exception':
|
|
12
|
+
return 'There are no branches to backport to. Aborting.';
|
|
13
|
+
case 'abort-exception':
|
|
14
|
+
return 'Aborted';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
4
17
|
class HandledError extends Error {
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
18
|
+
constructor(errorContext) {
|
|
19
|
+
super(getMessage(errorContext));
|
|
7
20
|
Error.captureStackTrace(this, HandledError);
|
|
8
21
|
this.name = 'HandledError';
|
|
9
|
-
|
|
22
|
+
if (typeof errorContext !== 'string') {
|
|
23
|
+
this.errorContext = errorContext;
|
|
24
|
+
}
|
|
10
25
|
}
|
|
11
26
|
}
|
|
12
27
|
exports.HandledError = HandledError;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import child_process from 'child_process';
|
|
3
|
-
export declare function exec(cmd: string, options: child_process.ExecOptions
|
|
3
|
+
export declare function exec(cmd: string, options: child_process.ExecOptions & {
|
|
4
|
+
cwd: string;
|
|
5
|
+
}): Promise<{
|
|
4
6
|
stdout: string;
|
|
5
7
|
stderr: string;
|
|
6
8
|
}>;
|
package/dist/services/env.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ValidConfigOptions } from '../options/options';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function getBackportDirPath(): string;
|
|
3
|
+
export declare function getLogfilePath({ logFilePath }: {
|
|
4
|
+
logFilePath?: string;
|
|
5
|
+
}): string;
|
|
3
6
|
export declare function getGlobalConfigPath(): string;
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function getRepoOwnerPath({ repoOwner }: ValidConfigOptions): string;
|
|
6
|
-
export declare function getRepoPath({ repoOwner, repoName }: ValidConfigOptions): string;
|
|
7
|
+
export declare function getRepoPath({ repoOwner, repoName, dir }: ValidConfigOptions): string;
|
package/dist/services/env.js
CHANGED
|
@@ -3,10 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getRepoPath = exports.
|
|
6
|
+
exports.getRepoPath = exports.getGlobalConfigPath = exports.getLogfilePath = exports.getBackportDirPath = void 0;
|
|
7
7
|
const os_1 = require("os");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
function
|
|
9
|
+
function getBackportDirPath() {
|
|
10
|
+
return path_1.default.join((0, os_1.homedir)(), '.backport');
|
|
11
|
+
}
|
|
12
|
+
exports.getBackportDirPath = getBackportDirPath;
|
|
13
|
+
function getLogfilePath({ logFilePath }) {
|
|
14
|
+
if (logFilePath) {
|
|
15
|
+
return path_1.default.resolve(logFilePath);
|
|
16
|
+
}
|
|
10
17
|
return path_1.default.join((0, os_1.homedir)(), '.backport', 'backport.log');
|
|
11
18
|
}
|
|
12
19
|
exports.getLogfilePath = getLogfilePath;
|
|
@@ -14,15 +21,10 @@ function getGlobalConfigPath() {
|
|
|
14
21
|
return path_1.default.join((0, os_1.homedir)(), '.backport', 'config.json');
|
|
15
22
|
}
|
|
16
23
|
exports.getGlobalConfigPath = getGlobalConfigPath;
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function getRepoOwnerPath({ repoOwner }) {
|
|
22
|
-
return path_1.default.join((0, os_1.homedir)(), '.backport', 'repositories', repoOwner);
|
|
23
|
-
}
|
|
24
|
-
exports.getRepoOwnerPath = getRepoOwnerPath;
|
|
25
|
-
function getRepoPath({ repoOwner, repoName }) {
|
|
24
|
+
function getRepoPath({ repoOwner, repoName, dir }) {
|
|
25
|
+
if (dir) {
|
|
26
|
+
return dir;
|
|
27
|
+
}
|
|
26
28
|
return path_1.default.join((0, os_1.homedir)(), '.backport', 'repositories', repoOwner, repoName);
|
|
27
29
|
}
|
|
28
30
|
exports.getRepoPath = getRepoPath;
|
package/dist/services/git.d.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import { ValidConfigOptions } from '../options/options';
|
|
2
2
|
import { ExpectedTargetPullRequest } from './sourceCommit/getExpectedTargetPullRequests';
|
|
3
3
|
import { Commit } from './sourceCommit/parseSourceCommit';
|
|
4
|
-
export declare function repoExists(options: ValidConfigOptions): Promise<boolean>;
|
|
5
|
-
export declare function deleteRepo(options: ValidConfigOptions): Promise<string[]>;
|
|
6
4
|
export declare function getRemoteUrl({ repoName, accessToken, gitHostname }: ValidConfigOptions, repoOwner: string): string;
|
|
7
|
-
export declare function cloneRepo(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare function
|
|
5
|
+
export declare function cloneRepo({ sourcePath, targetPath }: {
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
targetPath: string;
|
|
8
|
+
}, onProgress: (progress: number) => void): Promise<void>;
|
|
9
|
+
export declare function getLocalConfigFileCommitDate({ cwd }: {
|
|
10
|
+
cwd: string;
|
|
11
|
+
}): Promise<number | undefined>;
|
|
12
|
+
export declare function isLocalConfigFileUntracked({ cwd }: {
|
|
13
|
+
cwd: string;
|
|
14
|
+
}): Promise<boolean | undefined>;
|
|
15
|
+
export declare function isLocalConfigFileModified({ cwd }: {
|
|
16
|
+
cwd: string;
|
|
17
|
+
}): Promise<boolean | undefined>;
|
|
18
|
+
export declare function getRepoInfoFromGitRemotes({ cwd }: {
|
|
19
|
+
cwd: string;
|
|
20
|
+
}): Promise<{
|
|
12
21
|
repoOwner: string;
|
|
13
22
|
repoName: string;
|
|
14
|
-
}
|
|
23
|
+
}[]>;
|
|
24
|
+
export declare function getGitProjectRoot({ cwd }: {
|
|
25
|
+
cwd: string;
|
|
26
|
+
}): Promise<string | undefined>;
|
|
15
27
|
export declare function getIsCommitInBranch(options: ValidConfigOptions, commitSha: string): Promise<boolean>;
|
|
16
28
|
export declare function deleteRemote(options: ValidConfigOptions, remoteName: string): Promise<void>;
|
|
17
29
|
export declare function addRemote(options: ValidConfigOptions, remoteName: string): Promise<void>;
|
|
18
30
|
export declare function fetchBranch(options: ValidConfigOptions, branch: string): Promise<void>;
|
|
19
|
-
export declare function cherrypick(options: ValidConfigOptions, sha:
|
|
31
|
+
export declare function cherrypick(options: ValidConfigOptions, sha: string, mergedTargetPullRequest?: ExpectedTargetPullRequest): Promise<{
|
|
20
32
|
conflictingFiles: {
|
|
21
33
|
absolute: string;
|
|
22
34
|
relative: string;
|
|
@@ -55,3 +67,4 @@ export declare function pushBackportBranch({ options, backportBranch, }: {
|
|
|
55
67
|
stdout: string;
|
|
56
68
|
stderr: string;
|
|
57
69
|
}>;
|
|
70
|
+
export declare function getSourceRepoPath(options: ValidConfigOptions): Promise<string>;
|