next-issue 17.0.4 → 17.0.6
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/handover.mjs
CHANGED
|
@@ -66,11 +66,13 @@ export async function finishClosing(context, issue, log, state, started) {
|
|
|
66
66
|
};
|
|
67
67
|
return (await finishDone(job)).report;
|
|
68
68
|
}
|
|
69
|
-
export async function dropClosed(context, log, issue,
|
|
69
|
+
export async function dropClosed(context, log, issue, saved) {
|
|
70
70
|
log.event('issue.drop', { title: issue.title, reason: 'closed' });
|
|
71
71
|
try {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
if (openedOwnWorktree(saved)) {
|
|
73
|
+
await cleanUp(context, log, saved.branch);
|
|
74
|
+
await deleteBranches(context, log, saved.branch);
|
|
75
|
+
}
|
|
74
76
|
await dropState(context.repo, issue.number);
|
|
75
77
|
}
|
|
76
78
|
catch (error) {
|
|
@@ -134,6 +136,9 @@ async function removeOrKeep(context, log, kind, fields, remove) {
|
|
|
134
136
|
log.event(kind, fields);
|
|
135
137
|
}
|
|
136
138
|
}
|
|
139
|
+
function openedOwnWorktree(state) {
|
|
140
|
+
return state !== undefined && state.fresh !== true;
|
|
141
|
+
}
|
|
137
142
|
async function cleanUp(context, log, branch) {
|
|
138
143
|
const { repo, ports } = context;
|
|
139
144
|
try {
|
|
@@ -207,7 +212,7 @@ export async function claimedError(context, log, issue, state, error, started) {
|
|
|
207
212
|
log.event('hand-over.error', { error: message(failure) });
|
|
208
213
|
}
|
|
209
214
|
logIssueError(log, error, started);
|
|
210
|
-
if (state
|
|
215
|
+
if (openedOwnWorktree(state)) {
|
|
211
216
|
await cleanUp(context, log, state.branch);
|
|
212
217
|
}
|
|
213
218
|
const report = {
|
package/dist/shared/skip.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { runStopped } from './children.mjs';
|
|
2
2
|
import { elapsedMs } from './durations.mjs';
|
|
3
3
|
import { message } from './errors.mjs';
|
|
4
|
-
import { branchName } from './git.mjs';
|
|
5
4
|
import { handOverReply } from './hand-over-comments.mjs';
|
|
6
5
|
import { dropClosed, stopNow } from './handover.mjs';
|
|
7
6
|
import { hasLabel } from './labels.mjs';
|
|
@@ -88,9 +87,7 @@ export async function closedReport(context, log, issue, saved, started) {
|
|
|
88
87
|
catch (error) {
|
|
89
88
|
return readError(log, issue, saved, error, started);
|
|
90
89
|
}
|
|
91
|
-
return open
|
|
92
|
-
? undefined
|
|
93
|
-
: dropClosed(context, log, issue, saved?.branch ?? branchName(issue.number));
|
|
90
|
+
return open ? undefined : dropClosed(context, log, issue, saved);
|
|
94
91
|
}
|
|
95
92
|
/**
|
|
96
93
|
* A person gave up on a halted issue: it never resumes to check the base while it has the skip label, so its halt
|
package/dist/shared/worktree.mjs
CHANGED
|
@@ -20,6 +20,9 @@ export async function addWorktree(repo, issue, branch, base, remote, start) {
|
|
|
20
20
|
const existing = await findWorktree(repo, branch);
|
|
21
21
|
const path = existing ?? worktreePath(repo, issue);
|
|
22
22
|
const target = pushed ? upstream : remoteBase;
|
|
23
|
+
if (start) {
|
|
24
|
+
await keepUnmergedCommits(repo, branch, target);
|
|
25
|
+
}
|
|
23
26
|
if (existing === undefined) {
|
|
24
27
|
await keepDetachedEdits(path, branch);
|
|
25
28
|
await succeeds(repo.root, ['worktree', 'remove', '--force', path]);
|
|
@@ -42,6 +45,13 @@ async function keepDetachedEdits(path, branch) {
|
|
|
42
45
|
}
|
|
43
46
|
await git(path, ['branch', `${branch}-detached-${(await revision(path)).slice(0, 7)}`]);
|
|
44
47
|
}
|
|
48
|
+
async function keepUnmergedCommits(repo, branch, target) {
|
|
49
|
+
if (!(await hasBranch(repo, branch)) || (await isAncestor(repo.root, branch, target))) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const head = await git(repo.root, ['rev-parse', branch]);
|
|
53
|
+
await git(repo.root, ['branch', '--force', `${branch}-kept-${head.slice(0, 7)}`, branch]);
|
|
54
|
+
}
|
|
45
55
|
async function hasWork(repo, branch, pushed, base) {
|
|
46
56
|
if (!(await hasBranch(repo, branch))) {
|
|
47
57
|
return false;
|
package/dist/worker/pipeline.mjs
CHANGED
|
@@ -26,7 +26,7 @@ export async function processIssue(context, issue, slot) {
|
|
|
26
26
|
// A hand-over takes a closing issue back: its resume may revert or add to the change.
|
|
27
27
|
const closing = saved?.closing === true && !handedOver;
|
|
28
28
|
if (issue.closed === true && !closing) {
|
|
29
|
-
return dropClosed(context, log, issue, saved
|
|
29
|
+
return dropClosed(context, log, issue, saved);
|
|
30
30
|
}
|
|
31
31
|
const skip = closing
|
|
32
32
|
? undefined
|