backport 7.4.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -13
- package/dist/backportRun.d.ts +8 -3
- package/dist/backportRun.js +54 -42
- package/dist/entrypoint.cli.js +1 -1
- package/dist/entrypoint.module.d.ts +8 -3
- package/dist/entrypoint.module.js +3 -11
- package/dist/entrypoint.module.private.test.js +47 -346
- package/dist/options/cliArgs.d.ts +9 -4
- package/dist/options/cliArgs.js +28 -15
- package/dist/options/cliArgs.test.js +3 -3
- package/dist/options/config/globalConfig.d.ts +2 -2
- package/dist/options/config/globalConfig.js +13 -10
- package/dist/options/config/readConfigFile.d.ts +2 -2
- package/dist/options/options.d.ts +3 -3
- package/dist/options/options.test.js +5 -1
- package/dist/runSequentially.d.ts +6 -2
- package/dist/runSequentially.js +23 -7
- package/dist/scripts/postinstall.js +1 -0
- package/dist/scripts/postinstall.test.js +5 -1
- package/dist/services/HandledError.d.ts +1 -1
- package/dist/services/HandledError.js +2 -2
- package/dist/services/child-process-promisified.d.ts +19 -3
- package/dist/services/child-process-promisified.js +46 -17
- package/dist/services/git.d.ts +6 -7
- package/dist/services/git.integration.test.js +381 -65
- package/dist/services/git.js +188 -122
- package/dist/services/git.private.test.d.ts +1 -0
- package/dist/services/git.private.test.js +618 -0
- package/dist/services/git.test.js +167 -124
- package/dist/services/github/v3/addAssigneesToPullRequest.js +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +1 -1
- package/dist/services/github/v3/addReviewersToPullRequest.js +2 -1
- package/dist/services/github/v3/createPullRequest.js +3 -1
- package/dist/services/github/v3/createStatusComment.js +14 -15
- package/dist/services/github/v3/createStatusComment.test.js +15 -5
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +2 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +5 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +5 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +5 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +1 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +5 -1
- package/dist/services/logger.js +5 -1
- package/dist/services/test.d.ts +1 -0
- package/dist/services/test.js +23 -0
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +194 -12
- package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +17 -16
- package/dist/test/e2e/cli/runBackportViaCli.d.ts +2 -1
- package/dist/test/e2e/cli/runBackportViaCli.js +10 -2
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +26 -19
- package/dist/test/handleUnbackportedPullRequests.private.test.js +10 -8
- package/dist/test/sandbox.js +5 -1
- package/dist/test/setupFiles/automatic-mocks.js +5 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +1 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +7 -159
- package/dist/ui/getCommitsWithoutBackports.test.js +5 -1
- package/dist/ui/getGitConfigAuthor.js +1 -1
- package/dist/ui/getTargetBranches.test.js +5 -1
- package/dist/ui/ora.d.ts +1 -8
- package/dist/ui/setupRepo.js +1 -1
- package/dist/ui/setupRepo.test.js +98 -61
- package/dist/utils/isErrnoError.d.ts +2 -0
- package/dist/utils/isErrnoError.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +13 -13
- package/yarn.lock +414 -695
|
@@ -10,7 +10,7 @@ const lodash_1 = require("lodash");
|
|
|
10
10
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
11
11
|
const TIMEOUT_IN_SECONDS = 15;
|
|
12
12
|
jest.setTimeout(TIMEOUT_IN_SECONDS * 1000);
|
|
13
|
-
function runBackportViaCli(cliArgs, { showOra, waitForString, cwd, } = {}) {
|
|
13
|
+
function runBackportViaCli(cliArgs, { timeoutSeconds = 2, showOra, waitForString, cwd, } = {}) {
|
|
14
14
|
const tsNodeBinary = path_1.default.resolve('./node_modules/.bin/ts-node');
|
|
15
15
|
const entrypointFile = path_1.default.resolve('./src/entrypoint.cli.ts');
|
|
16
16
|
const proc = (0, child_process_1.spawn)(tsNodeBinary, [
|
|
@@ -22,7 +22,6 @@ function runBackportViaCli(cliArgs, { showOra, waitForString, cwd, } = {}) {
|
|
|
22
22
|
], { cwd });
|
|
23
23
|
return new Promise((resolve, reject) => {
|
|
24
24
|
let data = '';
|
|
25
|
-
const timeoutSeconds = 2;
|
|
26
25
|
const rejectOnTimeout = (0, lodash_1.debounce)(() => {
|
|
27
26
|
reject(`Expectation '${waitForString}' not found within ${timeoutSeconds} second in:\n\n${data.toString()}`);
|
|
28
27
|
}, timeoutSeconds * 1000, { maxWait: 15000 });
|
|
@@ -38,6 +37,15 @@ function runBackportViaCli(cliArgs, { showOra, waitForString, cwd, } = {}) {
|
|
|
38
37
|
resolve(output);
|
|
39
38
|
}
|
|
40
39
|
};
|
|
40
|
+
proc.on('exit', (code) => {
|
|
41
|
+
rejectOnTimeout.cancel();
|
|
42
|
+
if (code !== null && code === 0) {
|
|
43
|
+
resolve(data.toString());
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
reject(code);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
41
49
|
proc.stdout.on('data', onChunk);
|
|
42
50
|
// ora (loading spinner) is redirected to stderr
|
|
43
51
|
if (showOra) {
|
|
@@ -29,12 +29,14 @@ describe('entrypoint.module', () => {
|
|
|
29
29
|
beforeAll(async () => {
|
|
30
30
|
await resetState(accessToken);
|
|
31
31
|
res = await (0, entrypoint_module_1.backportRun)({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
options: {
|
|
33
|
+
dir: sandboxPath,
|
|
34
|
+
accessToken,
|
|
35
|
+
repoOwner: 'backport-org',
|
|
36
|
+
repoName: 'integration-test',
|
|
37
|
+
sha: COMMIT_SHA_1,
|
|
38
|
+
targetBranches: ['7.x'],
|
|
39
|
+
},
|
|
38
40
|
});
|
|
39
41
|
// @ts-expect-error
|
|
40
42
|
const pullRequestNumber = res.results[0].pullRequestNumber;
|
|
@@ -123,12 +125,14 @@ describe('entrypoint.module', () => {
|
|
|
123
125
|
beforeAll(async () => {
|
|
124
126
|
await resetState(accessToken);
|
|
125
127
|
res = await (0, entrypoint_module_1.backportRun)({
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
options: {
|
|
129
|
+
dir: sandboxPath,
|
|
130
|
+
accessToken,
|
|
131
|
+
repoOwner: 'backport-org',
|
|
132
|
+
repoName: 'integration-test',
|
|
133
|
+
sha: [COMMIT_SHA_1, COMMIT_SHA_2],
|
|
134
|
+
targetBranches: ['7.x'],
|
|
135
|
+
},
|
|
132
136
|
});
|
|
133
137
|
// @ts-expect-error
|
|
134
138
|
const pullRequestNumber = res.results[0].pullRequestNumber;
|
|
@@ -209,13 +213,15 @@ describe('entrypoint.module', () => {
|
|
|
209
213
|
beforeAll(async () => {
|
|
210
214
|
await resetState(accessToken);
|
|
211
215
|
res = await (0, entrypoint_module_1.backportRun)({
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
options: {
|
|
217
|
+
fork: false,
|
|
218
|
+
dir: sandboxPath,
|
|
219
|
+
accessToken,
|
|
220
|
+
repoOwner: 'backport-org',
|
|
221
|
+
repoName: 'integration-test',
|
|
222
|
+
sha: COMMIT_SHA_1,
|
|
223
|
+
targetBranches: ['7.x'],
|
|
224
|
+
},
|
|
219
225
|
});
|
|
220
226
|
// @ts-expect-error
|
|
221
227
|
const pullRequestNumber = res.results[0].pullRequestNumber;
|
|
@@ -326,6 +332,7 @@ async function deleteBranchOnGithub({ accessToken, repoOwner, repoName, branchNa
|
|
|
326
332
|
// console.log(
|
|
327
333
|
// `Could not delete ${repoOwner}:heads/${branchName} (${e.message})`
|
|
328
334
|
// );
|
|
335
|
+
//@ts-expect-error
|
|
329
336
|
if (e.message === 'Reference does not exist') {
|
|
330
337
|
return;
|
|
331
338
|
}
|
|
@@ -38,14 +38,16 @@ describe('Handle unbackported pull requests', () => {
|
|
|
38
38
|
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
39
39
|
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
40
40
|
const result = await (0, entrypoint_module_1.backportRun)({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
options: {
|
|
42
|
+
accessToken: accessToken,
|
|
43
|
+
repoOwner: 'backport-org',
|
|
44
|
+
repoName: 'repo-with-conflicts',
|
|
45
|
+
pullNumber: 12,
|
|
46
|
+
targetBranches: ['7.x'],
|
|
47
|
+
dir: sandboxPath,
|
|
48
|
+
ci: true,
|
|
49
|
+
publishStatusComment: false,
|
|
50
|
+
},
|
|
49
51
|
});
|
|
50
52
|
const commit =
|
|
51
53
|
//@ts-expect-error
|
package/dist/test/sandbox.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -166,7 +166,7 @@ async function waitForCherrypick(options, commit, targetBranch, gitConfigAuthor)
|
|
|
166
166
|
* Commit could not be cleanly cherrypicked: Initiating conflict resolution
|
|
167
167
|
*/
|
|
168
168
|
if (options.editor) {
|
|
169
|
-
await (0, child_process_promisified_1.
|
|
169
|
+
await (0, child_process_promisified_1.spawnPromise)(options.editor, [repoPath], options.cwd);
|
|
170
170
|
}
|
|
171
171
|
// list files with conflict markers + unstaged files and require user to resolve them
|
|
172
172
|
await listConflictingAndUnstagedFiles({
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -26,10 +30,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
26
30
|
const nock_1 = __importDefault(require("nock"));
|
|
27
31
|
const ora_1 = __importDefault(require("ora"));
|
|
28
32
|
const childProcess = __importStar(require("../services/child-process-promisified"));
|
|
29
|
-
const commitsByAuthorMock_1 = require("../services/github/v4/mocks/commitsByAuthorMock");
|
|
30
33
|
const logger = __importStar(require("../services/logger"));
|
|
31
|
-
const prompts = __importStar(require("../services/prompts"));
|
|
32
|
-
const ExecError_1 = require("../test/ExecError");
|
|
33
34
|
const nockHelpers_1 = require("../test/nockHelpers");
|
|
34
35
|
const cherrypickAndCreateTargetPullRequest_1 = require("./cherrypickAndCreateTargetPullRequest");
|
|
35
36
|
describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
@@ -39,9 +40,9 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
39
40
|
beforeEach(() => {
|
|
40
41
|
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
41
42
|
execSpy = jest
|
|
42
|
-
.spyOn(childProcess, '
|
|
43
|
+
.spyOn(childProcess, 'spawnPromise')
|
|
43
44
|
// mock all exec commands to respond without errors
|
|
44
|
-
.mockResolvedValue({ stdout: '', stderr: '' });
|
|
45
|
+
.mockResolvedValue({ stdout: '', stderr: '', code: 0, cmdArgs: [] });
|
|
45
46
|
consoleLogSpy = jest.spyOn(logger, 'consoleLog');
|
|
46
47
|
// ensure labels are added
|
|
47
48
|
addLabelsScope = (0, nock_1.default)('https://api.github.com')
|
|
@@ -249,14 +250,8 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
249
250
|
});
|
|
250
251
|
describe('when cherry-picking fails', () => {
|
|
251
252
|
let res;
|
|
252
|
-
let promptSpy;
|
|
253
|
-
let execSpy;
|
|
254
|
-
let commitsByAuthorCalls;
|
|
255
253
|
let createPullRequestCalls;
|
|
256
254
|
beforeEach(async () => {
|
|
257
|
-
// spies
|
|
258
|
-
promptSpy = jest.spyOn(prompts, 'confirmPrompt').mockResolvedValue(true);
|
|
259
|
-
execSpy = setupExecSpyForCherryPick();
|
|
260
255
|
const options = {
|
|
261
256
|
assignees: [],
|
|
262
257
|
authenticatedUsername: 'sqren_authenticated',
|
|
@@ -276,12 +271,6 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
276
271
|
.post('/repos/elastic/kibana/pulls')
|
|
277
272
|
.reply(200, { number: 1337, html_url: 'myHtmlUrl' });
|
|
278
273
|
createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
|
|
279
|
-
commitsByAuthorCalls =
|
|
280
|
-
(0, nockHelpers_1.mockGqlRequest)({
|
|
281
|
-
name: 'CommitsByAuthor',
|
|
282
|
-
statusCode: 200,
|
|
283
|
-
body: { data: commitsByAuthorMock_1.commitsByAuthorMock },
|
|
284
|
-
});
|
|
285
274
|
res = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
|
|
286
275
|
options,
|
|
287
276
|
commits: [
|
|
@@ -327,146 +316,5 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
327
316
|
it('returns the expected response', () => {
|
|
328
317
|
expect(res).toEqual({ didUpdate: false, url: 'myHtmlUrl', number: 1337 });
|
|
329
318
|
});
|
|
330
|
-
it('shows the right prompts', () => {
|
|
331
|
-
expect(promptSpy.mock.calls.length).toBe(4);
|
|
332
|
-
expect(promptSpy.mock.calls[0][0]).toMatchInlineSnapshot(`
|
|
333
|
-
"Fix the following conflicts manually:
|
|
334
|
-
|
|
335
|
-
Conflicting files:
|
|
336
|
-
- /myHomeDir/.backport/repositories/elastic/kibana/conflicting-file.txt
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Press ENTER when the conflicts are resolved and files are staged"
|
|
340
|
-
`);
|
|
341
|
-
expect(promptSpy.mock.calls[1][0]).toMatchInlineSnapshot(`
|
|
342
|
-
"Fix the following conflicts manually:
|
|
343
|
-
|
|
344
|
-
Conflicting files:
|
|
345
|
-
- /myHomeDir/.backport/repositories/elastic/kibana/conflicting-file.txt
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
Press ENTER when the conflicts are resolved and files are staged"
|
|
349
|
-
`);
|
|
350
|
-
expect(promptSpy.mock.calls[2][0]).toMatchInlineSnapshot(`
|
|
351
|
-
"Fix the following conflicts manually:
|
|
352
|
-
|
|
353
|
-
Conflicting files:
|
|
354
|
-
- /myHomeDir/.backport/repositories/elastic/kibana/conflicting-file.txt
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Press ENTER when the conflicts are resolved and files are staged"
|
|
358
|
-
`);
|
|
359
|
-
});
|
|
360
|
-
it('commitsByAuthor is called with correct arguments', () => {
|
|
361
|
-
expect(commitsByAuthorCalls[0].variables).toMatchInlineSnapshot(`
|
|
362
|
-
Object {
|
|
363
|
-
"authorId": null,
|
|
364
|
-
"commitPath": "conflicting-file.txt",
|
|
365
|
-
"dateSince": null,
|
|
366
|
-
"dateUntil": "2021-08-18T16:11:38Z",
|
|
367
|
-
"maxNumber": 10,
|
|
368
|
-
"repoName": "kibana",
|
|
369
|
-
"repoOwner": "elastic",
|
|
370
|
-
"sourceBranch": "myDefaultSourceBranch",
|
|
371
|
-
}
|
|
372
|
-
`);
|
|
373
|
-
});
|
|
374
|
-
it('calls exec correctly', () => {
|
|
375
|
-
expect(execSpy.mock.calls).toMatchSnapshot();
|
|
376
|
-
});
|
|
377
|
-
it('calls ora correctly', () => {
|
|
378
|
-
expect(ora_1.default.mock.calls.map((call) => call[0].text))
|
|
379
|
-
.toMatchInlineSnapshot(`
|
|
380
|
-
Array [
|
|
381
|
-
"Pulling latest changes",
|
|
382
|
-
"Cherry-picking: My original commit message",
|
|
383
|
-
"Finalizing cherrypick",
|
|
384
|
-
"Pushing branch \\"sqren:backport/6.x/commit-mySha\\"",
|
|
385
|
-
undefined,
|
|
386
|
-
"Creating pull request",
|
|
387
|
-
"Adding labels: backport",
|
|
388
|
-
]
|
|
389
|
-
`);
|
|
390
|
-
});
|
|
391
|
-
it('logs correctly', async () => {
|
|
392
|
-
expect(consoleLogSpy.mock.calls.map((call) => call[0]).join(''))
|
|
393
|
-
.toMatchInlineSnapshot(`
|
|
394
|
-
"
|
|
395
|
-
Backporting to 6.x:
|
|
396
|
-
The commit could not be backported due to conflicts
|
|
397
|
-
Please fix the conflicts in /myHomeDir/.backport/repositories/elastic/kibana
|
|
398
|
-
----------------------------------------
|
|
399
|
-
|
|
400
|
-
----------------------------------------
|
|
401
|
-
|
|
402
|
-
----------------------------------------
|
|
403
|
-
View pull request: myHtmlUrl"
|
|
404
|
-
`);
|
|
405
|
-
});
|
|
406
319
|
});
|
|
407
320
|
});
|
|
408
|
-
function setupExecSpyForCherryPick() {
|
|
409
|
-
let conflictingFilesCheck = 0;
|
|
410
|
-
let unstagedFilesCheck = 0;
|
|
411
|
-
return jest
|
|
412
|
-
.spyOn(childProcess, 'exec')
|
|
413
|
-
.mockImplementation(async (cmd) => {
|
|
414
|
-
// createFeatureBranch
|
|
415
|
-
if (cmd.includes('git checkout -B')) {
|
|
416
|
-
return { stdout: 'create feature branch succeeded', stderr: '' };
|
|
417
|
-
}
|
|
418
|
-
// git fetch
|
|
419
|
-
if (cmd.startsWith('git fetch')) {
|
|
420
|
-
return { stderr: '', stdout: '' };
|
|
421
|
-
}
|
|
422
|
-
// emulate cherrypick exception
|
|
423
|
-
if (cmd.includes('cherry-pick -x mySha')) {
|
|
424
|
-
throw new ExecError_1.ExecError({ cmd, code: 128 });
|
|
425
|
-
}
|
|
426
|
-
// getIsCommitInBranch
|
|
427
|
-
if (cmd.startsWith('git merge-base --is-ancestor')) {
|
|
428
|
-
return { stderr: '', stdout: '' };
|
|
429
|
-
}
|
|
430
|
-
// getConflictingFiles
|
|
431
|
-
if (cmd === 'git --no-pager diff --check') {
|
|
432
|
-
conflictingFilesCheck++;
|
|
433
|
-
if (conflictingFilesCheck >= 4) {
|
|
434
|
-
return { stderr: '', stdout: '' };
|
|
435
|
-
}
|
|
436
|
-
throw new ExecError_1.ExecError({
|
|
437
|
-
code: 2,
|
|
438
|
-
cmd,
|
|
439
|
-
stdout: `conflicting-file.txt:1: leftover conflict marker\nconflicting-file.txt:3: leftover conflict marker\nconflicting-file.txt:5: leftover conflict marker\n`,
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
// getUnstagedFiles
|
|
443
|
-
if (cmd === 'git --no-pager diff --name-only') {
|
|
444
|
-
unstagedFilesCheck++;
|
|
445
|
-
if (unstagedFilesCheck >= 5) {
|
|
446
|
-
return { stderr: '', stdout: '' };
|
|
447
|
-
}
|
|
448
|
-
return { stdout: `conflicting-file.txt\n`, stderr: '' };
|
|
449
|
-
}
|
|
450
|
-
// addUnstagedFiles
|
|
451
|
-
if (cmd === 'git add --update') {
|
|
452
|
-
return { stdout: ``, stderr: '' };
|
|
453
|
-
}
|
|
454
|
-
// finalizeCherrypick
|
|
455
|
-
if (cmd.includes('git commit --no-edit')) {
|
|
456
|
-
return { stdout: ``, stderr: '' };
|
|
457
|
-
}
|
|
458
|
-
// pushFeatureBranch
|
|
459
|
-
if (cmd.startsWith('git push ')) {
|
|
460
|
-
return { stdout: ``, stderr: '' };
|
|
461
|
-
}
|
|
462
|
-
// deleteFeatureBranch
|
|
463
|
-
if (cmd.includes('git branch -D ')) {
|
|
464
|
-
return { stdout: ``, stderr: '' };
|
|
465
|
-
}
|
|
466
|
-
// getIsMergeCommit
|
|
467
|
-
if (cmd.startsWith('git rev-list -1 --merges')) {
|
|
468
|
-
return { stdout: ``, stderr: '' };
|
|
469
|
-
}
|
|
470
|
-
throw new Error(`Missing exec mock for "${cmd}"`);
|
|
471
|
-
});
|
|
472
|
-
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getGitConfigAuthor = void 0;
|
|
4
4
|
const git_1 = require("../services/git");
|
|
5
5
|
async function getGitConfigAuthor(options) {
|
|
6
|
-
const localRepoPath = await (0, git_1.
|
|
6
|
+
const localRepoPath = await (0, git_1.getLocalSourceRepoPath)(options);
|
|
7
7
|
if (!localRepoPath) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/ui/ora.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import oraOriginal from 'ora';
|
|
2
|
-
export declare function ora(ci: boolean | undefined, text?: string | undefined): oraOriginal.Ora
|
|
3
|
-
start: (text?: string | undefined) => any;
|
|
4
|
-
succeed: () => void;
|
|
5
|
-
stop: () => void;
|
|
6
|
-
fail: () => void;
|
|
7
|
-
stopAndPersist: () => void;
|
|
8
|
-
text: string;
|
|
9
|
-
};
|
|
2
|
+
export declare function ora(ci: boolean | undefined, text?: string | undefined): oraOriginal.Ora;
|
package/dist/ui/setupRepo.js
CHANGED
|
@@ -16,7 +16,7 @@ async function setupRepo(options) {
|
|
|
16
16
|
if (!isAlreadyCloned) {
|
|
17
17
|
const spinner = (0, ora_1.ora)(options.ci).start();
|
|
18
18
|
try {
|
|
19
|
-
const localRepoPath = await (0, git_1.
|
|
19
|
+
const localRepoPath = await (0, git_1.getLocalSourceRepoPath)(options);
|
|
20
20
|
const remoteRepoPath = (0, git_1.getRemoteUrl)(options, options.repoOwner);
|
|
21
21
|
const sourcePath = localRepoPath ? localRepoPath : remoteRepoPath;
|
|
22
22
|
// show the full path for local repos, but only the host name for remote repos (to avoid showing the access token)
|