next-issue 14.4.21 → 14.4.22
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/dist/shared/git-land.mjs +15 -6
- package/dist/shared/revert.mjs +5 -2
- package/package.json +1 -1
package/dist/shared/git-land.mjs
CHANGED
|
@@ -28,8 +28,9 @@ export async function baseMoved(cwd, base, remote) {
|
|
|
28
28
|
}
|
|
29
29
|
export async function revertOnBase(cwd, revert) {
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const reverted = await pushRevert(cwd, revert);
|
|
32
|
+
if (reverted !== 'failed') {
|
|
33
|
+
return reverted;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
catch (error) {
|
|
@@ -37,11 +38,12 @@ export async function revertOnBase(cwd, revert) {
|
|
|
37
38
|
throw error;
|
|
38
39
|
}
|
|
39
40
|
await putBranchBack(cwd, revert.branch);
|
|
40
|
-
return
|
|
41
|
+
return 'failed';
|
|
41
42
|
}
|
|
42
43
|
function putBranchBack(cwd, branch) {
|
|
43
44
|
return evenWhenStopped(async () => {
|
|
44
45
|
await succeeds(cwd, ['revert', '--abort']);
|
|
46
|
+
await succeeds(cwd, ['cherry-pick', '--abort']);
|
|
45
47
|
await git(cwd, ['checkout', '--force', branch]);
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -67,7 +69,14 @@ async function pushRevert(cwd, revert) {
|
|
|
67
69
|
await git(cwd, ['checkout', '--force', '--detach', target]);
|
|
68
70
|
await git(cwd, ['clean', '-fd']);
|
|
69
71
|
if (!(await succeeds(cwd, ['revert', '--no-commit', ...shas.toReversed()]))) {
|
|
70
|
-
return
|
|
72
|
+
return 'failed';
|
|
73
|
+
}
|
|
74
|
+
if (await succeeds(cwd, ['diff', '--cached', '--quiet', 'HEAD'])) {
|
|
75
|
+
await git(cwd, ['revert', '--abort']);
|
|
76
|
+
await git(cwd, ['cherry-pick', '--no-commit', ...shas]);
|
|
77
|
+
await git(cwd, ['commit', '--no-verify', '-m', reapply]);
|
|
78
|
+
await git(cwd, ['checkout', '-B', branch]);
|
|
79
|
+
return 'already reverted';
|
|
71
80
|
}
|
|
72
81
|
await git(cwd, ['commit', '--no-verify', '-m', message]);
|
|
73
82
|
const reverted = await revision(cwd);
|
|
@@ -75,8 +84,8 @@ async function pushRevert(cwd, revert) {
|
|
|
75
84
|
if ((await pushToBase(cwd, remote, base)).pushed ||
|
|
76
85
|
(await isOnBase(cwd, base, remote, reverted))) {
|
|
77
86
|
await commitReapply(cwd, reverted, reapply, branch);
|
|
78
|
-
return
|
|
87
|
+
return 'pushed';
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
|
-
return
|
|
90
|
+
return 'failed';
|
|
82
91
|
}
|
package/dist/shared/revert.mjs
CHANGED
|
@@ -61,7 +61,7 @@ export async function revert(job) {
|
|
|
61
61
|
const { context, issue, log, state, branch, worktree } = job;
|
|
62
62
|
const { repo, config, ports, base } = context;
|
|
63
63
|
const shas = state.landed ?? [];
|
|
64
|
-
const
|
|
64
|
+
const reverted = await log.step('revert', { base, shas }, () => ports.revertOnBase(worktree, {
|
|
65
65
|
base,
|
|
66
66
|
remote: config.remote,
|
|
67
67
|
branch,
|
|
@@ -74,13 +74,16 @@ export async function revert(job) {
|
|
|
74
74
|
},
|
|
75
75
|
}));
|
|
76
76
|
state.reverting = undefined;
|
|
77
|
-
if (
|
|
77
|
+
if (reverted === 'failed') {
|
|
78
78
|
await writeState(repo, state);
|
|
79
79
|
return ` The revert of the change on ${base} failed, so the landed commits stay on ${base}.`;
|
|
80
80
|
}
|
|
81
81
|
restoreChange(state);
|
|
82
82
|
releaseSettled(state);
|
|
83
83
|
await writeState(repo, state);
|
|
84
|
+
if (reverted === 'already reverted') {
|
|
85
|
+
return ` The change is already reverted on ${base}, so the harness pushed no revert.`;
|
|
86
|
+
}
|
|
84
87
|
await updateLocalBase(job);
|
|
85
88
|
return ` The harness reverted the change on ${base}.`;
|
|
86
89
|
}
|