backport 7.4.0 → 8.2.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.
Files changed (244) hide show
  1. package/README.md +15 -16
  2. package/dist/backportRun.d.ts +12 -6
  3. package/dist/backportRun.js +64 -62
  4. package/dist/entrypoint.cli.js +4 -8
  5. package/dist/entrypoint.module.d.ts +13 -6
  6. package/dist/entrypoint.module.js +14 -20
  7. package/dist/entrypoint.module.private.test.js +47 -346
  8. package/dist/errors/BackportError.d.ts +19 -0
  9. package/dist/errors/BackportError.js +29 -0
  10. package/dist/lib/BackportError.d.ts +19 -0
  11. package/dist/lib/BackportError.js +29 -0
  12. package/dist/lib/cherrypickAndCreateTargetPullRequest.d.ts +11 -0
  13. package/dist/lib/cherrypickAndCreateTargetPullRequest.js +242 -0
  14. package/dist/lib/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
  15. package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +321 -0
  16. package/dist/lib/child-process-promisified.d.ts +25 -0
  17. package/dist/lib/child-process-promisified.js +60 -0
  18. package/dist/lib/env.d.ts +9 -0
  19. package/dist/lib/env.js +33 -0
  20. package/dist/lib/env.test.d.ts +1 -0
  21. package/dist/lib/env.test.js +26 -0
  22. package/dist/lib/getCommits.d.ts +2 -0
  23. package/dist/lib/getCommits.js +75 -0
  24. package/dist/lib/getCommitsWithoutBackports.d.ts +11 -0
  25. package/dist/lib/getCommitsWithoutBackports.js +68 -0
  26. package/dist/lib/getCommitsWithoutBackports.test.d.ts +1 -0
  27. package/dist/lib/getCommitsWithoutBackports.test.js +335 -0
  28. package/dist/lib/getGitConfigAuthor.d.ts +6 -0
  29. package/dist/lib/getGitConfigAuthor.js +15 -0
  30. package/dist/lib/getTargetBranches.d.ts +5 -0
  31. package/dist/lib/getTargetBranches.js +67 -0
  32. package/dist/lib/getTargetBranches.test.d.ts +1 -0
  33. package/dist/lib/getTargetBranches.test.js +210 -0
  34. package/dist/lib/git.d.ts +77 -0
  35. package/dist/lib/git.js +439 -0
  36. package/dist/lib/git.private.test.d.ts +1 -0
  37. package/dist/lib/git.private.test.js +618 -0
  38. package/dist/lib/git.test.d.ts +1 -0
  39. package/dist/lib/git.test.js +580 -0
  40. package/dist/lib/github/commitFormatters.d.ts +3 -0
  41. package/dist/lib/github/commitFormatters.js +17 -0
  42. package/dist/lib/github/commitFormatters.test.d.ts +1 -0
  43. package/dist/lib/github/commitFormatters.test.js +11 -0
  44. package/dist/lib/github/v3/addAssigneesToPullRequest.d.ts +2 -0
  45. package/dist/lib/github/v3/addAssigneesToPullRequest.js +32 -0
  46. package/dist/lib/github/v3/addAssigneesToPullRequest.test.d.ts +1 -0
  47. package/dist/lib/github/v3/addAssigneesToPullRequest.test.js +27 -0
  48. package/dist/lib/github/v3/addLabelsToPullRequest.d.ts +2 -0
  49. package/dist/lib/github/v3/addLabelsToPullRequest.js +30 -0
  50. package/dist/lib/github/v3/addReviewersToPullRequest.d.ts +2 -0
  51. package/dist/lib/github/v3/addReviewersToPullRequest.js +32 -0
  52. package/dist/lib/github/v3/createPullRequest.d.ts +29 -0
  53. package/dist/lib/github/v3/createPullRequest.js +91 -0
  54. package/dist/lib/github/v3/createPullRequest.test.d.ts +1 -0
  55. package/dist/lib/github/v3/createPullRequest.test.js +377 -0
  56. package/dist/lib/github/v3/createStatusComment.d.ts +11 -0
  57. package/dist/lib/github/v3/createStatusComment.js +138 -0
  58. package/dist/lib/github/v3/createStatusComment.test.d.ts +1 -0
  59. package/dist/lib/github/v3/createStatusComment.test.js +566 -0
  60. package/dist/lib/github/v3/getGithubV3ErrorMessage.d.ts +14 -0
  61. package/dist/lib/github/v3/getGithubV3ErrorMessage.js +16 -0
  62. package/dist/lib/github/v4/FetchPullRequestId.d.ts +2 -0
  63. package/dist/lib/github/v4/FetchPullRequestId.js +36 -0
  64. package/dist/lib/github/v4/apiRequestV4.d.ts +31 -0
  65. package/dist/lib/github/v4/apiRequestV4.js +71 -0
  66. package/dist/lib/github/v4/apiRequestV4.test.d.ts +1 -0
  67. package/dist/lib/github/v4/apiRequestV4.test.js +109 -0
  68. package/dist/lib/github/v4/disablePullRequestAutoMerge.d.ts +2 -0
  69. package/dist/lib/github/v4/disablePullRequestAutoMerge.js +32 -0
  70. package/dist/lib/github/v4/enablePullRequestAutoMerge.d.ts +2 -0
  71. package/dist/lib/github/v4/enablePullRequestAutoMerge.js +50 -0
  72. package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
  73. package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
  74. package/dist/lib/github/v4/fetchAuthorId.d.ts +10 -0
  75. package/dist/lib/github/v4/fetchAuthorId.js +28 -0
  76. package/dist/lib/github/v4/fetchAuthorId.private.test.d.ts +1 -0
  77. package/dist/lib/github/v4/fetchAuthorId.private.test.js +25 -0
  78. package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
  79. package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +93 -0
  80. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +11 -0
  81. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +58 -0
  82. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
  83. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +136 -0
  84. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.d.ts +11 -0
  85. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +48 -0
  86. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
  87. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +118 -0
  88. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +29 -0
  89. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +110 -0
  90. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
  91. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +196 -0
  92. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
  93. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +157 -0
  94. package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
  95. package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +107 -0
  96. package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
  97. package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +69 -0
  98. package/dist/lib/github/v4/fetchExistingPullRequest.d.ts +9 -0
  99. package/dist/lib/github/v4/fetchExistingPullRequest.js +64 -0
  100. package/dist/lib/github/v4/fetchExistingPullRequest.private.test.d.ts +1 -0
  101. package/dist/lib/github/v4/fetchExistingPullRequest.private.test.js +44 -0
  102. package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.d.ts +2 -0
  103. package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.js +39 -0
  104. package/dist/lib/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
  105. package/dist/lib/github/v4/fetchRemoteProjectConfig.js +49 -0
  106. package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
  107. package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.js +49 -0
  108. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +72 -0
  109. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +78 -0
  110. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
  111. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +116 -0
  112. package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +16 -0
  113. package/dist/lib/github/v4/getOptionsFromGithub/query.js +29 -0
  114. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
  115. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.js +61 -0
  116. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +1 -0
  117. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +72 -0
  118. package/dist/lib/github/v4/mocks/commitsByAuthorMock.d.ts +2 -0
  119. package/dist/lib/github/v4/mocks/commitsByAuthorMock.js +176 -0
  120. package/dist/lib/github/v4/throwOnInvalidAccessToken.d.ts +7 -0
  121. package/dist/lib/github/v4/throwOnInvalidAccessToken.js +45 -0
  122. package/dist/lib/github/v4/throwOnInvalidAccessToken.test.d.ts +1 -0
  123. package/dist/lib/github/v4/throwOnInvalidAccessToken.test.js +87 -0
  124. package/dist/lib/github/v4/validateTargetBranches.d.ts +14 -0
  125. package/dist/lib/github/v4/validateTargetBranches.js +46 -0
  126. package/dist/lib/github/v4/validateTargetBranches.private.test.d.ts +1 -0
  127. package/dist/lib/github/v4/validateTargetBranches.private.test.js +51 -0
  128. package/dist/lib/logger.d.ts +11 -0
  129. package/dist/lib/logger.js +80 -0
  130. package/dist/lib/ora.d.ts +2 -0
  131. package/dist/lib/ora.js +21 -0
  132. package/dist/lib/prompt.test.d.ts +1 -0
  133. package/dist/lib/prompt.test.js +139 -0
  134. package/dist/lib/prompts.d.ts +17 -0
  135. package/dist/lib/prompts.js +132 -0
  136. package/dist/lib/remoteConfig.d.ts +20 -0
  137. package/dist/lib/remoteConfig.js +52 -0
  138. package/dist/lib/sequentially.d.ts +1 -0
  139. package/dist/lib/sequentially.js +10 -0
  140. package/dist/lib/setupRepo.d.ts +2 -0
  141. package/dist/lib/setupRepo.js +56 -0
  142. package/dist/lib/setupRepo.test.d.ts +1 -0
  143. package/dist/lib/setupRepo.test.js +278 -0
  144. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +16 -0
  145. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.js +102 -0
  146. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
  147. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.js +467 -0
  148. package/dist/lib/sourceCommit/getMockSourceCommit.d.ts +26 -0
  149. package/dist/lib/sourceCommit/getMockSourceCommit.js +103 -0
  150. package/dist/lib/sourceCommit/parseSourceCommit.d.ts +108 -0
  151. package/dist/lib/sourceCommit/parseSourceCommit.js +123 -0
  152. package/dist/lib/sourceCommit/parseSourceCommit.test.d.ts +1 -0
  153. package/dist/lib/sourceCommit/parseSourceCommit.test.js +226 -0
  154. package/dist/options/ConfigOptions.d.ts +4 -2
  155. package/dist/options/cliArgs.d.ts +14 -6
  156. package/dist/options/cliArgs.js +50 -22
  157. package/dist/options/cliArgs.test.js +128 -4
  158. package/dist/options/config/config.d.ts +5 -4
  159. package/dist/options/config/config.js +3 -5
  160. package/dist/options/config/config.test.js +0 -1
  161. package/dist/options/config/globalConfig.d.ts +5 -3
  162. package/dist/options/config/globalConfig.js +17 -14
  163. package/dist/options/config/readConfigFile.d.ts +5 -3
  164. package/dist/options/config/readConfigFile.js +2 -2
  165. package/dist/options/options.d.ts +41 -5
  166. package/dist/options/options.js +24 -24
  167. package/dist/options/options.test.js +117 -55
  168. package/dist/runSequentially.d.ts +14 -9
  169. package/dist/runSequentially.js +27 -12
  170. package/dist/scripts/postinstall.js +4 -3
  171. package/dist/scripts/postinstall.test.js +6 -2
  172. package/dist/services/BackportError.d.ts +19 -0
  173. package/dist/services/BackportError.js +29 -0
  174. package/dist/services/HandledBackportError.d.ts +19 -0
  175. package/dist/services/HandledBackportError.js +29 -0
  176. package/dist/services/HandledError.d.ts +2 -2
  177. package/dist/services/HandledError.js +7 -7
  178. package/dist/services/child-process-promisified.d.ts +19 -3
  179. package/dist/services/child-process-promisified.js +46 -17
  180. package/dist/services/git.d.ts +6 -7
  181. package/dist/services/git.integration.test.js +381 -65
  182. package/dist/services/git.js +189 -123
  183. package/dist/services/git.private.test.d.ts +1 -0
  184. package/dist/services/git.private.test.js +618 -0
  185. package/dist/services/git.test.js +167 -124
  186. package/dist/services/github/v3/addAssigneesToPullRequest.js +1 -1
  187. package/dist/services/github/v3/addLabelsToPullRequest.js +1 -1
  188. package/dist/services/github/v3/addReviewersToPullRequest.js +2 -1
  189. package/dist/services/github/v3/createPullRequest.js +4 -2
  190. package/dist/services/github/v3/createStatusComment.js +16 -17
  191. package/dist/services/github/v3/createStatusComment.test.js +20 -9
  192. package/dist/services/github/v4/apiRequestV4.js +2 -2
  193. package/dist/services/github/v4/apiRequestV4.test.js +2 -2
  194. package/dist/services/github/v4/enablePullRequestAutoMerge.js +2 -4
  195. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +4 -3
  196. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +5 -1
  197. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -2
  198. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +5 -1
  199. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -3
  200. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +5 -1
  201. package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +3 -2
  202. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +2 -2
  203. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +5 -1
  204. package/dist/services/github/v4/throwOnInvalidAccessToken.js +5 -5
  205. package/dist/services/logger.js +5 -1
  206. package/dist/services/test.d.ts +1 -0
  207. package/dist/services/test.js +23 -0
  208. package/dist/state.d.ts +0 -0
  209. package/dist/state.js +1 -0
  210. package/dist/test/e2e/cli/commit-author.private.test.js +4 -4
  211. package/dist/test/e2e/cli/different-merge-strategies.private.test.js +27 -25
  212. package/dist/test/e2e/cli/entrypoint.cli.private.test.js +53 -75
  213. package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.d.ts +1 -0
  214. package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.js +80 -0
  215. package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.d.ts +1 -0
  216. package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.js +199 -0
  217. package/dist/test/e2e/cli/interactive-error-handling.private.test.d.ts +1 -0
  218. package/dist/test/e2e/cli/interactive-error-handling.private.test.js +80 -0
  219. package/dist/test/e2e/cli/non-interactive-error-handling.private.test.d.ts +1 -0
  220. package/dist/test/e2e/cli/non-interactive-error-handling.private.test.js +198 -0
  221. package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +28 -29
  222. package/dist/test/e2e/cli/runBackportViaCli.d.ts +6 -2
  223. package/dist/test/e2e/cli/runBackportViaCli.js +44 -23
  224. package/dist/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +22 -14
  225. package/dist/test/e2e/module/entrypoint.module.mutation.test.js +28 -21
  226. package/dist/test/handleUnbackportedPullRequests.private.test.js +11 -8
  227. package/dist/test/sandbox.js +5 -1
  228. package/dist/test/setupFiles/automatic-mocks.js +6 -2
  229. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -4
  230. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +7 -159
  231. package/dist/ui/getCommits.js +2 -2
  232. package/dist/ui/getCommitsWithoutBackports.test.js +5 -1
  233. package/dist/ui/getGitConfigAuthor.js +1 -1
  234. package/dist/ui/getTargetBranches.js +3 -3
  235. package/dist/ui/getTargetBranches.test.js +5 -1
  236. package/dist/ui/ora.d.ts +1 -8
  237. package/dist/ui/setupRepo.js +3 -3
  238. package/dist/ui/setupRepo.test.js +98 -61
  239. package/dist/utils/isErrnoError.d.ts +2 -0
  240. package/dist/utils/isErrnoError.js +7 -0
  241. package/dist/utils/packageVersion.d.ts +1 -1
  242. package/dist/utils/packageVersion.js +1 -1
  243. package/package.json +19 -19
  244. package/yarn.lock +472 -701
@@ -0,0 +1,242 @@
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.cherrypickAndCreateTargetPullRequest = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const lodash_1 = require("lodash");
9
+ const BackportError_1 = require("./BackportError");
10
+ const child_process_promisified_1 = require("./child-process-promisified");
11
+ const env_1 = require("./env");
12
+ const getCommitsWithoutBackports_1 = require("./getCommitsWithoutBackports");
13
+ const getGitConfigAuthor_1 = require("./getGitConfigAuthor");
14
+ const git_1 = require("./git");
15
+ const commitFormatters_1 = require("./github/commitFormatters");
16
+ const addAssigneesToPullRequest_1 = require("./github/v3/addAssigneesToPullRequest");
17
+ const addLabelsToPullRequest_1 = require("./github/v3/addLabelsToPullRequest");
18
+ const addReviewersToPullRequest_1 = require("./github/v3/addReviewersToPullRequest");
19
+ const createPullRequest_1 = require("./github/v3/createPullRequest");
20
+ const enablePullRequestAutoMerge_1 = require("./github/v4/enablePullRequestAutoMerge");
21
+ const logger_1 = require("./logger");
22
+ const ora_1 = require("./ora");
23
+ const prompts_1 = require("./prompts");
24
+ const sequentially_1 = require("./sequentially");
25
+ async function cherrypickAndCreateTargetPullRequest({ options, commits, targetBranch, }) {
26
+ const backportBranch = getBackportBranchName(targetBranch, commits);
27
+ const repoForkOwner = (0, git_1.getRepoForkOwner)(options);
28
+ (0, logger_1.consoleLog)(`\n${chalk_1.default.bold(`Backporting to ${targetBranch}:`)}`);
29
+ const [gitConfigAuthor] = await Promise.all([
30
+ (0, getGitConfigAuthor_1.getGitConfigAuthor)(options),
31
+ (0, git_1.createBackportBranch)({ options, targetBranch, backportBranch }),
32
+ ]);
33
+ await (0, sequentially_1.sequentially)(commits, (commit) => waitForCherrypick(options, commit, targetBranch, gitConfigAuthor));
34
+ if (options.dryRun) {
35
+ (0, ora_1.ora)(options.interactive).succeed('Dry run complete');
36
+ return { url: 'https://localhost/dry-run', didUpdate: false, number: 1337 };
37
+ }
38
+ await (0, git_1.pushBackportBranch)({ options, backportBranch });
39
+ await (0, git_1.deleteBackportBranch)({ options, backportBranch });
40
+ const prPayload = {
41
+ owner: options.repoOwner,
42
+ repo: options.repoName,
43
+ title: (0, createPullRequest_1.getTitle)({ options, commits, targetBranch }),
44
+ body: (0, createPullRequest_1.getPullRequestBody)({ options, commits, targetBranch }),
45
+ head: `${repoForkOwner}:${backportBranch}`,
46
+ base: targetBranch, // eg. 7.x
47
+ };
48
+ const targetPullRequest = await (0, createPullRequest_1.createPullRequest)({ options, prPayload });
49
+ // add assignees to target pull request
50
+ const assignees = options.autoAssign
51
+ ? [options.authenticatedUsername]
52
+ : options.assignees;
53
+ if (options.assignees.length > 0) {
54
+ await (0, addAssigneesToPullRequest_1.addAssigneesToPullRequest)(options, targetPullRequest.number, assignees);
55
+ }
56
+ // add reviewers to target pull request
57
+ if (options.reviewers.length > 0) {
58
+ await (0, addReviewersToPullRequest_1.addReviewersToPullRequest)(options, targetPullRequest.number, options.reviewers);
59
+ }
60
+ // add labels to target pull request
61
+ if (options.targetPRLabels.length > 0) {
62
+ await (0, addLabelsToPullRequest_1.addLabelsToPullRequest)(options, targetPullRequest.number, options.targetPRLabels);
63
+ }
64
+ // make PR auto mergable
65
+ if (options.autoMerge) {
66
+ await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)(options, targetPullRequest.number);
67
+ }
68
+ // add labels to source pull requests
69
+ if (options.sourcePRLabels.length > 0) {
70
+ const promises = commits.map((commit) => {
71
+ if (commit.sourcePullRequest) {
72
+ return (0, addLabelsToPullRequest_1.addLabelsToPullRequest)(options, commit.sourcePullRequest.number, options.sourcePRLabels);
73
+ }
74
+ });
75
+ await Promise.all(promises);
76
+ }
77
+ (0, logger_1.consoleLog)(`View pull request: ${targetPullRequest.url}`);
78
+ return targetPullRequest;
79
+ }
80
+ exports.cherrypickAndCreateTargetPullRequest = cherrypickAndCreateTargetPullRequest;
81
+ /*
82
+ * Returns the name of the backport branch without remote name
83
+ *
84
+ * Examples:
85
+ * For a single PR: `backport/7.x/pr-1234`
86
+ * For a single commit: `backport/7.x/commit-abcdef`
87
+ * For multiple: `backport/7.x/pr-1234_commit-abcdef`
88
+ */
89
+ function getBackportBranchName(targetBranch, commits) {
90
+ const refValues = commits
91
+ .map((commit) => commit.sourcePullRequest
92
+ ? `pr-${commit.sourcePullRequest.number}`
93
+ : `commit-${(0, commitFormatters_1.getShortSha)(commit.sourceCommit.sha)}`)
94
+ .join('_')
95
+ .slice(0, 200);
96
+ return `backport/${targetBranch}/${refValues}`;
97
+ }
98
+ async function waitForCherrypick(options, commit, targetBranch, gitConfigAuthor) {
99
+ const spinnerText = `Cherry-picking: ${chalk_1.default.greenBright((0, commitFormatters_1.getFirstLine)(commit.sourceCommit.message))}`;
100
+ const mergedTargetPullRequest = commit.expectedTargetPullRequests.find((pr) => pr.state === 'MERGED' && pr.branch === targetBranch);
101
+ const cherrypickSpinner = (0, ora_1.ora)(options.interactive, spinnerText).start();
102
+ let conflictingFiles;
103
+ let unstagedFiles;
104
+ let needsResolving;
105
+ const commitAuthor = getCommitAuthor({
106
+ options,
107
+ gitConfigAuthor,
108
+ commit,
109
+ });
110
+ try {
111
+ await (0, git_1.fetchBranch)(options, commit.sourceBranch);
112
+ ({ conflictingFiles, unstagedFiles, needsResolving } = await (0, git_1.cherrypick)({
113
+ options,
114
+ sha: commit.sourceCommit.sha,
115
+ mergedTargetPullRequest,
116
+ commitAuthor,
117
+ }));
118
+ // no conflicts encountered
119
+ if (!needsResolving) {
120
+ cherrypickSpinner.succeed();
121
+ return;
122
+ }
123
+ // cherrypick failed due to conflicts
124
+ cherrypickSpinner.fail();
125
+ }
126
+ catch (e) {
127
+ cherrypickSpinner.fail();
128
+ throw e;
129
+ }
130
+ const repoPath = (0, env_1.getRepoPath)(options);
131
+ // resolve conflicts automatically
132
+ if (options.autoFixConflicts) {
133
+ const autoResolveSpinner = (0, ora_1.ora)(options.interactive, 'Attempting to resolve conflicts automatically').start();
134
+ const didAutoFix = await options.autoFixConflicts({
135
+ files: conflictingFiles.map((f) => f.absolute),
136
+ directory: repoPath,
137
+ logger: logger_1.logger,
138
+ targetBranch,
139
+ });
140
+ // conflicts were automatically resolved
141
+ if (didAutoFix) {
142
+ autoResolveSpinner.succeed();
143
+ return;
144
+ }
145
+ autoResolveSpinner.fail();
146
+ }
147
+ const conflictingFilesRelative = conflictingFiles
148
+ .map((f) => f.relative)
149
+ .slice(0, 50);
150
+ const commitsWithoutBackports = await (0, getCommitsWithoutBackports_1.getCommitsWithoutBackports)({
151
+ options,
152
+ commit,
153
+ targetBranch,
154
+ conflictingFiles: conflictingFilesRelative,
155
+ });
156
+ if (!options.interactive) {
157
+ throw new BackportError_1.BackportError({
158
+ code: 'merge-conflict-exception',
159
+ commitsWithoutBackports,
160
+ conflictingFiles: conflictingFilesRelative,
161
+ });
162
+ }
163
+ (0, logger_1.consoleLog)(chalk_1.default.bold('\nThe commit could not be backported due to conflicts\n'));
164
+ (0, logger_1.consoleLog)(`Please fix the conflicts in ${repoPath}`);
165
+ if (commitsWithoutBackports.length > 0) {
166
+ (0, logger_1.consoleLog)(chalk_1.default.italic(`Hint: Before fixing the conflicts manually you should consider backporting the following pull requests to "${targetBranch}":`));
167
+ (0, logger_1.consoleLog)(`${commitsWithoutBackports.map((c) => c.formatted).join('\n')}\n\n`);
168
+ }
169
+ /*
170
+ * Commit could not be cleanly cherrypicked: Initiating conflict resolution
171
+ */
172
+ if (options.editor) {
173
+ await (0, child_process_promisified_1.spawnPromise)(options.editor, [repoPath], options.cwd);
174
+ }
175
+ // list files with conflict markers + unstaged files and require user to resolve them
176
+ await listConflictingAndUnstagedFiles({
177
+ retries: 0,
178
+ options,
179
+ conflictingFiles: conflictingFiles.map((f) => f.absolute),
180
+ unstagedFiles,
181
+ });
182
+ // Conflicts should be resolved and files staged at this point
183
+ const stagingSpinner = (0, ora_1.ora)(options.interactive, `Finalizing cherrypick`).start();
184
+ try {
185
+ // Run `git commit`
186
+ await (0, git_1.commitChanges)(commit, options);
187
+ stagingSpinner.succeed();
188
+ }
189
+ catch (e) {
190
+ stagingSpinner.fail();
191
+ throw e;
192
+ }
193
+ }
194
+ async function listConflictingAndUnstagedFiles({ retries, options, conflictingFiles, unstagedFiles, }) {
195
+ const hasUnstagedFiles = !(0, lodash_1.isEmpty)((0, lodash_1.difference)(unstagedFiles, conflictingFiles));
196
+ const hasConflictingFiles = !(0, lodash_1.isEmpty)(conflictingFiles);
197
+ if (!hasConflictingFiles && !hasUnstagedFiles) {
198
+ return;
199
+ }
200
+ // add divider between prompts
201
+ if (retries > 0) {
202
+ (0, logger_1.consoleLog)('\n----------------------------------------\n');
203
+ }
204
+ const header = chalk_1.default.reset(`Fix the following conflicts manually:`);
205
+ // show conflict section if there are conflicting files
206
+ const conflictSection = hasConflictingFiles
207
+ ? `Conflicting files:\n${chalk_1.default.reset(conflictingFiles.map((file) => ` - ${file}`).join('\n'))}`
208
+ : '';
209
+ const unstagedSection = hasUnstagedFiles
210
+ ? `Unstaged files:\n${chalk_1.default.reset(unstagedFiles.map((file) => ` - ${file}`).join('\n'))}`
211
+ : '';
212
+ const didConfirm = await (0, prompts_1.confirmPrompt)(`${header}\n\n${conflictSection}\n${unstagedSection}\n\nPress ENTER when the conflicts are resolved and files are staged`);
213
+ if (!didConfirm) {
214
+ throw new BackportError_1.BackportError({ code: 'abort-conflict-resolution-exception' });
215
+ }
216
+ const MAX_RETRIES = 100;
217
+ if (retries++ > MAX_RETRIES) {
218
+ throw new Error(`Maximum number of retries (${MAX_RETRIES}) exceeded`);
219
+ }
220
+ const [_conflictingFiles, _unstagedFiles] = await Promise.all([
221
+ (0, git_1.getConflictingFiles)(options),
222
+ (0, git_1.getUnstagedFiles)(options),
223
+ ]);
224
+ await listConflictingAndUnstagedFiles({
225
+ retries,
226
+ options,
227
+ conflictingFiles: _conflictingFiles.map((file) => file.absolute),
228
+ unstagedFiles: _unstagedFiles,
229
+ });
230
+ }
231
+ function getCommitAuthor({ options, gitConfigAuthor, commit, }) {
232
+ if (options.resetAuthor) {
233
+ return {
234
+ name: options.authenticatedUsername,
235
+ email: `<${options.authenticatedUsername}@users.noreply.github.com>`,
236
+ };
237
+ }
238
+ return {
239
+ name: options.gitAuthorName ?? gitConfigAuthor?.name ?? commit.author.name,
240
+ email: options.gitAuthorEmail ?? gitConfigAuthor?.email ?? commit.author.email,
241
+ };
242
+ }
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const os_1 = __importDefault(require("os"));
30
+ const nock_1 = __importDefault(require("nock"));
31
+ const ora_1 = __importDefault(require("ora"));
32
+ const nockHelpers_1 = require("../test/nockHelpers");
33
+ const cherrypickAndCreateTargetPullRequest_1 = require("./cherrypickAndCreateTargetPullRequest");
34
+ const childProcess = __importStar(require("./child-process-promisified"));
35
+ const logger = __importStar(require("./logger"));
36
+ describe('cherrypickAndCreateTargetPullRequest', () => {
37
+ let execSpy;
38
+ let addLabelsScope;
39
+ let consoleLogSpy;
40
+ beforeEach(() => {
41
+ jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
42
+ execSpy = jest
43
+ .spyOn(childProcess, 'spawnPromise')
44
+ // mock all exec commands to respond without errors
45
+ .mockResolvedValue({ stdout: '', stderr: '', code: 0, cmdArgs: [] });
46
+ consoleLogSpy = jest.spyOn(logger, 'consoleLog');
47
+ // ensure labels are added
48
+ addLabelsScope = (0, nock_1.default)('https://api.github.com')
49
+ .post('/repos/elastic/kibana/issues/1337/labels', {
50
+ labels: ['backport'],
51
+ })
52
+ .reply(200);
53
+ });
54
+ afterEach(() => {
55
+ jest.clearAllMocks();
56
+ addLabelsScope.done();
57
+ nock_1.default.cleanAll();
58
+ });
59
+ describe('when commit has a pull request reference', () => {
60
+ let res;
61
+ let createPullRequestCalls;
62
+ beforeEach(async () => {
63
+ const options = {
64
+ assignees: [],
65
+ authenticatedUsername: 'sqren_authenticated',
66
+ author: 'sqren',
67
+ fork: true,
68
+ interactive: true,
69
+ prTitle: '[{targetBranch}] {commitMessages}',
70
+ repoForkOwner: 'sqren',
71
+ repoName: 'kibana',
72
+ repoOwner: 'elastic',
73
+ reviewers: [],
74
+ sourceBranch: 'myDefaultSourceBranch',
75
+ sourcePRLabels: [],
76
+ targetPRLabels: ['backport'],
77
+ };
78
+ const commits = [
79
+ {
80
+ author: {
81
+ email: 'soren.louv@elastic.co',
82
+ name: 'Søren Louv-Jansen',
83
+ },
84
+ sourceBranch: '7.x',
85
+ sourceCommit: {
86
+ committedDate: 'fff',
87
+ sha: 'mySha',
88
+ message: 'My original commit message (#1000)',
89
+ },
90
+ sourcePullRequest: {
91
+ url: 'foo',
92
+ number: 1000,
93
+ mergeCommit: {
94
+ sha: 'mySha',
95
+ message: 'My original commit message (#1000)',
96
+ },
97
+ },
98
+ expectedTargetPullRequests: [],
99
+ },
100
+ {
101
+ author: {
102
+ email: 'soren.louv@elastic.co',
103
+ name: 'Søren Louv-Jansen',
104
+ },
105
+ sourceBranch: '7.x',
106
+ sourceCommit: {
107
+ committedDate: 'ggg',
108
+ sha: 'mySha2',
109
+ message: 'My other commit message (#2000)',
110
+ },
111
+ sourcePullRequest: {
112
+ url: 'foo',
113
+ number: 2000,
114
+ mergeCommit: {
115
+ sha: 'mySha2',
116
+ message: 'My other commit message (#2000)',
117
+ },
118
+ },
119
+ expectedTargetPullRequests: [],
120
+ },
121
+ ];
122
+ const scope = (0, nock_1.default)('https://api.github.com')
123
+ .post('/repos/elastic/kibana/pulls')
124
+ .reply(200, { number: 1337, html_url: 'myHtmlUrl' });
125
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
126
+ res = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
127
+ options,
128
+ commits,
129
+ targetBranch: '6.x',
130
+ });
131
+ scope.done();
132
+ nock_1.default.cleanAll();
133
+ });
134
+ it('creates the pull request with multiple PR references', () => {
135
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
136
+ Array [
137
+ Object {
138
+ "base": "6.x",
139
+ "body": "# Backport
140
+
141
+ This will backport the following commits from \`7.x\` to \`6.x\`:
142
+ - [My original commit message (#1000)](foo)
143
+ - [My other commit message (#2000)](foo)
144
+
145
+ <!--- Backport version: 1.2.3-mocked -->
146
+
147
+ ### Questions ?
148
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
149
+ "head": "sqren:backport/6.x/pr-1000_pr-2000",
150
+ "title": "[6.x] My original commit message (#1000) | My other commit message (#2000)",
151
+ },
152
+ ]
153
+ `);
154
+ });
155
+ it('returns the expected response', () => {
156
+ expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
157
+ });
158
+ it('should make correct git commands', () => {
159
+ expect(execSpy.mock.calls).toMatchSnapshot();
160
+ });
161
+ it('logs correctly', () => {
162
+ expect(consoleLogSpy.mock.calls.length).toBe(2);
163
+ expect(consoleLogSpy.mock.calls[0][0]).toMatchInlineSnapshot(`
164
+ "
165
+ Backporting to 6.x:"
166
+ `);
167
+ expect(consoleLogSpy.mock.calls[1][0]).toMatchInlineSnapshot(`"View pull request: myHtmlUrl"`);
168
+ });
169
+ it('should start the spinner with the correct text', () => {
170
+ expect(ora_1.default.mock.calls.map((call) => call[0].text))
171
+ .toMatchInlineSnapshot(`
172
+ Array [
173
+ "Pulling latest changes",
174
+ "Cherry-picking: My original commit message (#1000)",
175
+ "Cherry-picking: My other commit message (#2000)",
176
+ "Pushing branch \\"sqren:backport/6.x/pr-1000_pr-2000\\"",
177
+ undefined,
178
+ "Creating pull request",
179
+ "Adding labels: backport",
180
+ ]
181
+ `);
182
+ });
183
+ });
184
+ describe('when commit does not have a pull request reference', () => {
185
+ let res;
186
+ let createPullRequestCalls;
187
+ beforeEach(async () => {
188
+ const options = {
189
+ assignees: [],
190
+ authenticatedUsername: 'sqren_authenticated',
191
+ author: 'sqren',
192
+ fork: true,
193
+ prTitle: '[{targetBranch}] {commitMessages}',
194
+ repoForkOwner: 'the_fork_owner',
195
+ repoName: 'kibana',
196
+ repoOwner: 'elastic',
197
+ reviewers: [],
198
+ sourcePRLabels: [],
199
+ targetPRLabels: ['backport'],
200
+ };
201
+ const commits = [
202
+ {
203
+ author: {
204
+ email: 'soren.louv@elastic.co',
205
+ name: 'Søren Louv-Jansen',
206
+ },
207
+ sourceCommit: {
208
+ committedDate: 'hhh',
209
+ sha: 'mySha',
210
+ message: 'My original commit message',
211
+ },
212
+ sourceBranch: '7.x',
213
+ expectedTargetPullRequests: [],
214
+ },
215
+ ];
216
+ const scope = (0, nock_1.default)('https://api.github.com')
217
+ .post('/repos/elastic/kibana/pulls')
218
+ .reply(200, { number: 1337, html_url: 'myHtmlUrl' });
219
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
220
+ res = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
221
+ options,
222
+ commits,
223
+ targetBranch: '6.x',
224
+ });
225
+ scope.done();
226
+ nock_1.default.cleanAll();
227
+ });
228
+ it('creates the pull request with commit reference', () => {
229
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
230
+ Array [
231
+ Object {
232
+ "base": "6.x",
233
+ "body": "# Backport
234
+
235
+ This will backport the following commits from \`7.x\` to \`6.x\`:
236
+ - My original commit message (mySha)
237
+
238
+ <!--- Backport version: 1.2.3-mocked -->
239
+
240
+ ### Questions ?
241
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
242
+ "head": "the_fork_owner:backport/6.x/commit-mySha",
243
+ "title": "[6.x] My original commit message",
244
+ },
245
+ ]
246
+ `);
247
+ });
248
+ it('returns the expected response', () => {
249
+ expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
250
+ });
251
+ });
252
+ describe('when cherry-picking fails', () => {
253
+ let res;
254
+ let createPullRequestCalls;
255
+ beforeEach(async () => {
256
+ const options = {
257
+ assignees: [],
258
+ authenticatedUsername: 'sqren_authenticated',
259
+ author: 'sqren',
260
+ fork: true,
261
+ githubApiBaseUrlV4: 'http://localhost/graphql',
262
+ prTitle: '[{targetBranch}] {commitMessages}',
263
+ repoForkOwner: 'sqren',
264
+ repoName: 'kibana',
265
+ repoOwner: 'elastic',
266
+ reviewers: [],
267
+ sourceBranch: 'myDefaultSourceBranch',
268
+ sourcePRLabels: [],
269
+ targetPRLabels: ['backport'],
270
+ };
271
+ const scope = (0, nock_1.default)('https://api.github.com')
272
+ .post('/repos/elastic/kibana/pulls')
273
+ .reply(200, { number: 1337, html_url: 'myHtmlUrl' });
274
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
275
+ res = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
276
+ options,
277
+ commits: [
278
+ {
279
+ author: {
280
+ email: 'soren.louv@elastic.co',
281
+ name: 'Søren Louv-Jansen',
282
+ },
283
+ sourceCommit: {
284
+ committedDate: '2021-08-18T16:11:38Z',
285
+ sha: 'mySha',
286
+ message: 'My original commit message',
287
+ },
288
+ sourceBranch: '7.x',
289
+ expectedTargetPullRequests: [],
290
+ },
291
+ ],
292
+ targetBranch: '6.x',
293
+ });
294
+ scope.done();
295
+ nock_1.default.cleanAll();
296
+ });
297
+ it('creates the pull request with commit reference', () => {
298
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
299
+ Array [
300
+ Object {
301
+ "base": "6.x",
302
+ "body": "# Backport
303
+
304
+ This will backport the following commits from \`7.x\` to \`6.x\`:
305
+ - My original commit message (mySha)
306
+
307
+ <!--- Backport version: 1.2.3-mocked -->
308
+
309
+ ### Questions ?
310
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
311
+ "head": "sqren:backport/6.x/commit-mySha",
312
+ "title": "[6.x] My original commit message",
313
+ },
314
+ ]
315
+ `);
316
+ });
317
+ it('returns the expected response', () => {
318
+ expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
319
+ });
320
+ });
321
+ });
@@ -0,0 +1,25 @@
1
+ /// <reference types="node" />
2
+ import childProcess from 'child_process';
3
+ export declare function exec(cmd: string, options: childProcess.ExecOptions & {
4
+ cwd: string;
5
+ }): Promise<{
6
+ stdout: string;
7
+ stderr: string;
8
+ }>;
9
+ export declare function spawnPromise(cmd: string, cmdArgs: string[], cwd: string): Promise<{
10
+ cmdArgs: string[];
11
+ code: number | null;
12
+ stderr: string;
13
+ stdout: string;
14
+ }>;
15
+ export declare const spawnOriginal: typeof childProcess.spawn;
16
+ export declare type SpawnErrorContext = {
17
+ cmdArgs: string[];
18
+ code: number;
19
+ stderr: string;
20
+ stdout: string;
21
+ };
22
+ export declare class SpawnError extends Error {
23
+ context: SpawnErrorContext;
24
+ constructor(context: SpawnErrorContext);
25
+ }
@@ -0,0 +1,60 @@
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.SpawnError = exports.spawnOriginal = exports.spawnPromise = exports.exec = void 0;
7
+ const child_process_1 = __importDefault(require("child_process"));
8
+ const util_1 = require("util");
9
+ const logger_1 = require("./logger");
10
+ const execPromisified = (0, util_1.promisify)(child_process_1.default.exec);
11
+ async function exec(cmd, options) {
12
+ const res = await execPromisified(cmd, {
13
+ maxBuffer: 100 * 1024 * 1024,
14
+ ...options,
15
+ });
16
+ return res;
17
+ }
18
+ exports.exec = exec;
19
+ async function spawnPromise(cmd, cmdArgs, cwd) {
20
+ return new Promise(function (resolve, reject) {
21
+ const subprocess = child_process_1.default.spawn(cmd, cmdArgs, { cwd });
22
+ let stderr = '';
23
+ let stdout = '';
24
+ subprocess.stdout.on('data', (data) => {
25
+ stdout += data;
26
+ });
27
+ subprocess.stderr.on('data', (data) => {
28
+ stderr += data;
29
+ });
30
+ subprocess.on('close', (code) => {
31
+ const fullCmd = `${cmd} ${cmdArgs.join(' ')}`;
32
+ logger_1.logger.info(`Running command: "${fullCmd}"`);
33
+ if (code === 0 || code === null) {
34
+ resolve({ cmdArgs, code, stderr, stdout });
35
+ }
36
+ else {
37
+ const err = new SpawnError({ cmdArgs, code, stderr, stdout });
38
+ logger_1.logger.verbose(`Error when running command: "${fullCmd}"`, err);
39
+ reject(err);
40
+ }
41
+ });
42
+ subprocess.on('error', (err) => {
43
+ reject(err);
44
+ });
45
+ });
46
+ }
47
+ exports.spawnPromise = spawnPromise;
48
+ exports.spawnOriginal = child_process_1.default.spawn;
49
+ class SpawnError extends Error {
50
+ constructor(context) {
51
+ const cmdArgs = context.cmdArgs.join(' ');
52
+ const message = `Code: ${context.code}, Args: "${cmdArgs}", Message: ${context.stderr.trim()}`;
53
+ super(message);
54
+ Error.captureStackTrace(this, SpawnError);
55
+ this.name = 'SpawnError';
56
+ this.message = message;
57
+ this.context = context;
58
+ }
59
+ }
60
+ exports.SpawnError = SpawnError;
@@ -0,0 +1,9 @@
1
+ import { ValidConfigOptions } from '../options/options';
2
+ import { LogLevel } from './logger';
3
+ export declare function getBackportDirPath(): string;
4
+ export declare function getLogfilePath({ logFilePath, logLevel, }: {
5
+ logFilePath?: string;
6
+ logLevel: LogLevel;
7
+ }): string;
8
+ export declare function getGlobalConfigPath(globalConfigFile: string | undefined): string;
9
+ export declare function getRepoPath({ repoOwner, repoName, dir }: ValidConfigOptions): string;