@gitkraken/core-gitlens 0.28.0 → 0.30.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/CHANGELOG.md +48 -1
- package/dist/git/cache.d.ts +39 -1
- package/dist/git/cache.js +108 -7
- package/dist/git/cache.js.map +1 -1
- package/dist/git/providers/branches.d.ts +17 -12
- package/dist/git/providers/revision.d.ts +4 -0
- package/dist/git/watching/worktreeSummary.d.ts +16 -7
- package/dist/git/watching/worktreeSummary.js +44 -14
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +3 -3
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/exec.d.ts +2 -2
- package/dist/git-cli/exec/exec.js +2 -2
- package/dist/git-cli/exec/gitDirResolver.d.ts +6 -1
- package/dist/git-cli/exec/gitDirResolver.js +9 -4
- package/dist/git-cli/exec/gitDirResolver.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +91 -13
- package/dist/git-cli/providers/branches.js +673 -176
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +1 -1
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +4 -0
- package/dist/git-cli/providers/revision.js +64 -3
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/ipc/ipcServer.d.ts +6 -1
- package/dist/ipc/ipcServer.js +15 -6
- package/dist/ipc/ipcServer.js.map +1 -1
- package/dist/plus/ai/errors.js +4 -4
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +1 -1
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +45 -2
- package/dist/plus/ai/models/results.d.ts +41 -0
- package/dist/plus/ai/models/results.js +14 -0
- package/dist/plus/ai/models/results.js.map +1 -0
- package/dist/plus/ai/prompts.d.ts +6 -0
- package/dist/plus/ai/prompts.js +255 -5
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +2 -2
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -0
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts +4 -0
- package/dist/plus/ai/utils/ai.utils.js +8 -1
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +15 -1
- package/dist/plus/ai/utils/results.utils.js +80 -4
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +2 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +1 -1
- package/dist/plus/integrations/authentication/models.js +2 -0
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/constants.d.ts +2 -1
- package/dist/plus/integrations/constants.js +12 -2
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/fieldPresence.js +17 -1
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +1 -1
- package/dist/plus/integrations/integrationService.js +8 -2
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +5 -6
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +11 -1
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +91 -0
- package/dist/plus/integrations/providers/asana.js +344 -0
- package/dist/plus/integrations/providers/asana.js.map +1 -0
- package/dist/plus/integrations/providers/azure/azure.js +3 -2
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +3 -2
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +7 -1
- package/dist/plus/integrations/providers/azureDevOps.js +9 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/discovery.js +2 -1
- package/dist/plus/integrations/providers/bitbucket-server/discovery.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +2 -2
- package/dist/plus/integrations/providers/github.js +2 -2
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +5 -0
- package/dist/plus/integrations/providers/issueSorts.js +6 -1
- package/dist/plus/integrations/providers/issueSorts.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +2 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +19 -3
- package/dist/plus/integrations/providers/models.js +12 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providerApiClient.d.ts +0 -3
- package/dist/plus/integrations/providers/providerApiClient.js +1 -3
- package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +22 -1
- package/dist/plus/integrations/providers/providersApi.js +63 -12
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +1 -0
- package/dist/plus/integrations/providers/utils.js +8 -2
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts +3 -3
- package/dist/plus/integrations/reads/hierarchy.utils.js +4 -4
- package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +29 -21
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +18 -10
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/utils/domain.utils.js +2 -1
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.js +5 -13
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/diff.d.ts +19 -0
- package/dist/utils/diff.js +121 -3
- package/dist/utils/diff.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +0 -1
- package/dist/utils/env/node/exec.js +2 -14
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.js +7 -1
- package/dist/utils/path.js.map +1 -1
- package/docs/integrations.md +72 -43
- package/package.json +2 -2
|
@@ -26,15 +26,15 @@ export type AheadOfBaseTier = 'preferred' | 'user' | 'detected' | 'recorded' | '
|
|
|
26
26
|
export interface AheadOfBase {
|
|
27
27
|
/** The base HEAD was measured against; `undefined` when there is none (see `getAheadOfBase`) */
|
|
28
28
|
readonly base: {
|
|
29
|
-
/** The ref the count was taken against: the chosen base or its tracking ref, whichever forked nearer HEAD */
|
|
29
|
+
/** The ref the count was taken against: the chosen base or its tracking ref, whichever forked nearer HEAD by `forkPoint`, a tie going to the tracking ref. A local base forks nearer only past git's `--fork-point` reading of its tracking ref, so one holding commits its tracking ref held and moved off defers to it */
|
|
30
30
|
readonly ref: string;
|
|
31
|
-
/** Commits on HEAD not on `ref` */
|
|
31
|
+
/** Commits on HEAD past `forkPoint`, the ones `<forkPoint>..HEAD` lists: those not on `ref`, except past a fork point `ref` was rewritten off, where the commits a patch comparison shows it replayed don't count; with no `forkPoint`, every commit on HEAD not on `ref`. The sole exception: when a read settling `forkPoint` fails and the merge base can't be read either, `forkPoint` stays where it was read while this still counts every commit on HEAD not on `ref`, which can differ from what `<forkPoint>..HEAD` lists */
|
|
32
32
|
readonly ahead: number;
|
|
33
33
|
/** The commit `ref` pointed at, from the cached ref list; `undefined` when no listed ref matches it */
|
|
34
34
|
readonly sha: string | undefined;
|
|
35
|
-
/** Where HEAD forked from `ref`: git's `--fork-point` reading of `ref`'s reflog, else the merge base; `undefined` when they share no history */
|
|
35
|
+
/** Where HEAD forked from `ref`: its tip when HEAD contains it; otherwise git's `--fork-point` reading of `ref`'s reflog, else the merge base. A reading `ref`'s history still holds stands, as `ref`'s reflog file shows (every move since it forward) or one ancestry check does. One `ref` left behind (rebased, reset, force-pushed) is settled by patch: the commits it holds that `ref` lacks are compared with `ref`'s 256 newest first-parent commits, and the fork point is the newest of them below which each has a copy of the same patch there (rewritten), the commit itself when all do, else the merge base; one with no copy is HEAD's, shown rather than hidden. A read that fails takes the merge base, and git's reading stays only when that fails too. `undefined` when they share no history */
|
|
36
36
|
readonly forkPoint: string | undefined;
|
|
37
|
-
/** The source the base came from: the `preferredTarget` option, the user's merge target, the detected one, the base recorded against the branch, the branch git's reflog says this branch was created from (unless the default branch forked strictly nearer HEAD), the default branch, or — when the branch is the default branch — the branch's own upstream */
|
|
37
|
+
/** The source the base came from: the `preferredTarget` option, the user's merge target, the detected one, the base recorded against the branch, the branch git's reflog says this branch was created from (unless the default branch forked strictly nearer HEAD, each by its `forkPoint`), the default branch, or — when the branch is the default branch — the branch's own upstream */
|
|
38
38
|
readonly tier: AheadOfBaseTier;
|
|
39
39
|
} | undefined;
|
|
40
40
|
/** Why there is no base; set exactly when `base` is `undefined`: `'none'` when nothing resolved, `'self'` when the base is the branch itself at HEAD's commit (or the default branch has no upstream to measure against), `'unborn'` when HEAD has no commit yet */
|
|
@@ -47,9 +47,9 @@ export interface AheadOfBase {
|
|
|
47
47
|
/** Which source decided a merge target (see `getMergeTarget`): an {@link AheadOfBaseTier}, the pull request's base, or the branch HEAD was on when the branch was created */
|
|
48
48
|
export type MergeTargetTier = AheadOfBaseTier | 'pr' | 'inferred';
|
|
49
49
|
export interface MergeTarget {
|
|
50
|
-
/** The ref the branch is measured against: the chosen target or its tracking ref, whichever the branch forked from nearer */
|
|
50
|
+
/** The ref the branch is measured against: the chosen target or its tracking ref, whichever the branch forked from nearer, chosen as `AheadOfBase.ref` is */
|
|
51
51
|
readonly ref: string;
|
|
52
|
-
/** Where the branch forked from `ref
|
|
52
|
+
/** Where the branch forked from `ref`, as `AheadOfBase.forkPoint` settles it from git's `--fork-point` reading of `ref`'s reflog, else the merge base; `undefined` when they share no history. With no count taken, a tip of `ref` the branch contains is the fork point too, unless every read settling it fails, which leaves git's reading, one that can name a commit past the tip */
|
|
53
53
|
readonly forkPoint: string | undefined;
|
|
54
54
|
readonly tier: MergeTargetTier;
|
|
55
55
|
}
|
|
@@ -219,7 +219,9 @@ export interface GitBranchesSubProvider {
|
|
|
219
219
|
* local branch or else the remote ref; then, in the same remote order, `<remote>/main` or `<remote>/master`, again as
|
|
220
220
|
* the local branch or else the remote ref; then `init.defaultBranch`, `main`, `master` — from local refs only, never
|
|
221
221
|
* the network. On the default branch itself the base is its upstream (`upstream/<branch>` when an `upstream` remote has
|
|
222
|
-
* it, else `<branch>@{u}`), tier `'upstream'`. The count is the right side of
|
|
222
|
+
* it, else `<branch>@{u}`), tier `'upstream'`. The count is HEAD's commits past `base.forkPoint`: the right side of
|
|
223
|
+
* `<base>...HEAD`, except past a fork point the base was rebased off, where it's the right side of
|
|
224
|
+
* `<forkPoint>...HEAD`. `base` is `undefined`
|
|
223
225
|
* when no base resolves, when the base is the branch itself (by name, or as its copy on one of the repo's remotes) at
|
|
224
226
|
* HEAD's own commit — or the default branch has no upstream — or when HEAD has no commit yet; `reason`
|
|
225
227
|
* then says which (`'none'`, `'self'` or `'unborn'`) and `dependsOn` is given either way. `base.sha` is the tip of
|
|
@@ -260,11 +262,14 @@ export interface GitBranchesSubProvider {
|
|
|
260
262
|
* own ref (the only listed ref its name answers to) and any `<remote>/HEAD` symref still pointing at it, with the
|
|
261
263
|
* default branch resolving as `previous.defaultBranch` when one did (absent, it can't be shown), the repository
|
|
262
264
|
* isn't shallow, the base moved only forward (its old tip and every value its reflog
|
|
263
|
-
* took since are in its new tip's history), and HEAD's
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
265
|
+
* took since are in its new tip's history), and HEAD's commits past its new tip and every commit the base's reflog
|
|
266
|
+
* reaches off its new tip's history are `previous.base.ahead` in number, its count past the fork point, without
|
|
267
|
+
* `previous.base.forkPoint` among them (a fork point the reflog no longer holds, off the new tip's history, is).
|
|
268
|
+
* Equal counts mean none of HEAD's commits past the fork point reached the base or its reflog, so HEAD's common
|
|
269
|
+
* history with the base and its reflog, and with that the fork point, the reflog's move off it, the count past it
|
|
270
|
+
* and the choice of base, stay as they were; only `base.sha` moves, and `defaultBranch` is kept. A fork point the
|
|
271
|
+
* base was rebased off, still a value of its reflog but off its new tip's history, is settled again as a full read
|
|
272
|
+
* does, and must keep the fork point and its count. `undefined` when any of that can't be shown, and a full `getAheadOfBase` is due.
|
|
268
273
|
*/
|
|
269
274
|
getAheadOfBaseAfterBaseMove?(repoPath: string, branch: string | undefined, previous: {
|
|
270
275
|
readonly head: string;
|
|
@@ -18,6 +18,10 @@ export interface GitRevisionSubProvider {
|
|
|
18
18
|
exists?(repoPath: string, path: string, revOrOptions?: string | {
|
|
19
19
|
untracked?: 'only' | 'include';
|
|
20
20
|
}): Promise<boolean>;
|
|
21
|
+
/** Blob ids the given repo-relative paths have right now in one layer — the index, or the working
|
|
22
|
+
* tree hashed as git would store it (nothing is written). A submodule's id is its commit (in the
|
|
23
|
+
* working tree, the one checked out); paths absent from that layer, or that can't be hashed, are left out. */
|
|
24
|
+
getBlobIds?(repoPath: string, paths: readonly string[], source: 'index' | 'working', cancellation?: AbortSignal): Promise<Map<string, string>>;
|
|
21
25
|
/** The empty tree's id in this repository's object format (SHA-1 or SHA-256). */
|
|
22
26
|
getEmptyTreeSha(repoPath: string): Promise<string>;
|
|
23
27
|
getRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined>;
|
|
@@ -61,9 +61,9 @@ export interface WorktreeSummary {
|
|
|
61
61
|
*/
|
|
62
62
|
readonly baseDependsOn: readonly string[];
|
|
63
63
|
/**
|
|
64
|
-
* The latest recompute failed (worktree gone, lock contention); the other fields hold the
|
|
65
|
-
* when only the base read failed: the other fields are fresh, and `base` and
|
|
66
|
-
* or `undefined` and empty if the branch changed.
|
|
64
|
+
* The latest recompute failed (worktree gone, lock contention, git past its time limit); the other fields hold the
|
|
65
|
+
* last values read. Also set when only the base read failed: the other fields are fresh, and `base` and
|
|
66
|
+
* `baseDependsOn` are their last values, or `undefined` and empty if the branch changed.
|
|
67
67
|
*/
|
|
68
68
|
readonly stale: boolean;
|
|
69
69
|
}
|
|
@@ -223,8 +223,8 @@ export declare class WorktreeSummaryService implements UnifiedDisposable {
|
|
|
223
223
|
subscribe(repoPath: string, options?: WorktreeSummarySubscribeOptions): WorktreeSummarySubscription;
|
|
224
224
|
/**
|
|
225
225
|
* Returns a worktree's summary. For a subscribed worktree, the cached value — after waiting for any run in flight
|
|
226
|
-
* or pending; it rejects with the read's error when there is still no value
|
|
227
|
-
* re-reading what moved since (see {@link getSummarySnapshot}).
|
|
226
|
+
* or pending; it rejects with the read's error when there is still no value, after one more read when git ran out
|
|
227
|
+
* of time. Otherwise the last read of it, re-reading what moved since (see {@link getSummarySnapshot}).
|
|
228
228
|
*/
|
|
229
229
|
getSummary(repoPath: string, cancellation?: AbortSignal): Promise<WorktreeSummary>;
|
|
230
230
|
/**
|
|
@@ -233,15 +233,24 @@ export declare class WorktreeSummaryService implements UnifiedDisposable {
|
|
|
233
233
|
* the saved read's (see {@link WorktreeSummarySubscription.dirtyReadAt}), which `probeDirty` reads again. Any other
|
|
234
234
|
* answers from its last read, re-reading only the groups whose inputs moved since (no git when none did), and in
|
|
235
235
|
* full the first time, or after a failed or stale read. Its working tree is unwatched, so the dirty flag is re-read
|
|
236
|
-
* only when the index file moved, or with `probeDirty`; a rejection drops the last read
|
|
237
|
-
* cached answers, which only a `.git` watch of the
|
|
236
|
+
* only when the index file moved, or with `probeDirty`; a rejection drops the last read, unless the read was cut
|
|
237
|
+
* short, which says nothing against it. Its inputs are core's cached answers, which only a `.git` watch of the
|
|
238
|
+
* worktree (or core's own writes) keeps current.
|
|
238
239
|
*/
|
|
239
240
|
getSummarySnapshot(repoPath: string, options?: {
|
|
240
241
|
probeDirty?: boolean;
|
|
241
242
|
cancellation?: AbortSignal;
|
|
242
243
|
}): Promise<WorktreeSummarySnapshot>;
|
|
243
244
|
private getSubscribedSnapshot;
|
|
245
|
+
/**
|
|
246
|
+
* A first read cut short (git ran past its time limit, or was killed) says nothing about the worktree, and no git
|
|
247
|
+
* event may come to read it again, so each reader reads once more, joining a read in flight, before getting its
|
|
248
|
+
* error, and so does each new subscriber. Only they cause this: reads of a worktree run one at a time, each bounded
|
|
249
|
+
* by the time limit and holding a read slot.
|
|
250
|
+
*/
|
|
244
251
|
private getSubscribedSummary;
|
|
252
|
+
/** The value once any run in flight or pending is done, `undefined` when it has none */
|
|
253
|
+
private waitForValue;
|
|
245
254
|
/** Joins the read in flight for `key`, or starts one; the read is aborted only once no caller waits for it */
|
|
246
255
|
private getUnwatchedSnapshot;
|
|
247
256
|
/**
|
|
@@ -238,14 +238,16 @@ var WorktreeSummaryService = class {
|
|
|
238
238
|
this.unwatchedFlights.delete(key);
|
|
239
239
|
target.running = this.start(target);
|
|
240
240
|
}
|
|
241
|
-
} else if (target.handle != null)
|
|
242
|
-
|
|
241
|
+
} else if (target.handle != null) {
|
|
242
|
+
subscription.attach(target.handle.session);
|
|
243
|
+
if (target.running == null && target.value == null && isCancellationError(target.error)) this.queue(target, allFields);
|
|
244
|
+
} else if (target.running == null && !target.disposed) target.running = this.start(target);
|
|
243
245
|
return subscription;
|
|
244
246
|
}
|
|
245
247
|
/**
|
|
246
248
|
* Returns a worktree's summary. For a subscribed worktree, the cached value — after waiting for any run in flight
|
|
247
|
-
* or pending; it rejects with the read's error when there is still no value
|
|
248
|
-
* re-reading what moved since (see {@link getSummarySnapshot}).
|
|
249
|
+
* or pending; it rejects with the read's error when there is still no value, after one more read when git ran out
|
|
250
|
+
* of time. Otherwise the last read of it, re-reading what moved since (see {@link getSummarySnapshot}).
|
|
249
251
|
*/
|
|
250
252
|
async getSummary(repoPath, cancellation) {
|
|
251
253
|
const key = getRepositoryKey(repoPath);
|
|
@@ -259,8 +261,9 @@ var WorktreeSummaryService = class {
|
|
|
259
261
|
* the saved read's (see {@link WorktreeSummarySubscription.dirtyReadAt}), which `probeDirty` reads again. Any other
|
|
260
262
|
* answers from its last read, re-reading only the groups whose inputs moved since (no git when none did), and in
|
|
261
263
|
* full the first time, or after a failed or stale read. Its working tree is unwatched, so the dirty flag is re-read
|
|
262
|
-
* only when the index file moved, or with `probeDirty`; a rejection drops the last read
|
|
263
|
-
* cached answers, which only a `.git` watch of the
|
|
264
|
+
* only when the index file moved, or with `probeDirty`; a rejection drops the last read, unless the read was cut
|
|
265
|
+
* short, which says nothing against it. Its inputs are core's cached answers, which only a `.git` watch of the
|
|
266
|
+
* worktree (or core's own writes) keeps current.
|
|
264
267
|
*/
|
|
265
268
|
async getSummarySnapshot(repoPath, options) {
|
|
266
269
|
const key = getRepositoryKey(repoPath);
|
|
@@ -279,11 +282,31 @@ var WorktreeSummaryService = class {
|
|
|
279
282
|
dirtyReadAt: entry.dirtyReadAt
|
|
280
283
|
};
|
|
281
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* A first read cut short (git ran past its time limit, or was killed) says nothing about the worktree, and no git
|
|
287
|
+
* event may come to read it again, so each reader reads once more, joining a read in flight, before getting its
|
|
288
|
+
* error, and so does each new subscriber. Only they cause this: reads of a worktree run one at a time, each bounded
|
|
289
|
+
* by the time limit and holding a read slot.
|
|
290
|
+
*/
|
|
282
291
|
async getSubscribedSummary(entry, cancellation) {
|
|
292
|
+
let summary = await this.waitForValue(entry, cancellation);
|
|
293
|
+
if (summary != null) return summary;
|
|
294
|
+
if (isCancellationError(entry.error)) {
|
|
295
|
+
if (cancellation?.aborted) throw new CancellationError();
|
|
296
|
+
if (entry.running == null) {
|
|
297
|
+
if (entry.handle == null) entry.running = this.start(entry);
|
|
298
|
+
else this.queue(entry, allFields);
|
|
299
|
+
}
|
|
300
|
+
summary = await this.waitForValue(entry, cancellation);
|
|
301
|
+
if (summary != null) return summary;
|
|
302
|
+
}
|
|
303
|
+
throw entry.error ?? /* @__PURE__ */ new Error(`No summary available for '${entry.key}'`);
|
|
304
|
+
}
|
|
305
|
+
/** The value once any run in flight or pending is done, `undefined` when it has none */
|
|
306
|
+
async waitForValue(entry, cancellation) {
|
|
283
307
|
if (entry.running != null) await (cancellation != null ? raceWithSignal(entry.running, cancellation) : entry.running);
|
|
284
308
|
if (entry.disposed) throw new CancellationError();
|
|
285
|
-
|
|
286
|
-
throw entry.error ?? /* @__PURE__ */ new Error(`No summary available for '${entry.key}'`);
|
|
309
|
+
return entry.value;
|
|
287
310
|
}
|
|
288
311
|
/** Joins the read in flight for `key`, or starts one; the read is aborted only once no caller waits for it */
|
|
289
312
|
async getUnwatchedSnapshot(key, probeDirty, cancellation) {
|
|
@@ -461,7 +484,7 @@ var WorktreeSummaryService = class {
|
|
|
461
484
|
} catch (ex) {
|
|
462
485
|
if (entry.disposed) return;
|
|
463
486
|
entry.running = void 0;
|
|
464
|
-
|
|
487
|
+
this.fail(entry, ex);
|
|
465
488
|
return;
|
|
466
489
|
}
|
|
467
490
|
if (entry.disposed) return;
|
|
@@ -685,7 +708,7 @@ var WorktreeSummaryService = class {
|
|
|
685
708
|
const signal = entry.abort.signal;
|
|
686
709
|
result = await readSummary(repo, entry.key, fields, previous, entry.baseKeys, entry.baseConfigKey, entry.baseDefaultBranch, baseMoves, signal, this.verifyBaseRemeasure, (due, moves) => this.probeRead(repo, previous, tips, due, moves, probed, signal));
|
|
687
710
|
} catch (ex) {
|
|
688
|
-
if (entry.disposed
|
|
711
|
+
if (entry.disposed) return;
|
|
689
712
|
this.fail(entry, ex);
|
|
690
713
|
return;
|
|
691
714
|
}
|
|
@@ -898,7 +921,7 @@ async function readSummary(repo, key, fields, previous, previousBaseKeys, previo
|
|
|
898
921
|
try {
|
|
899
922
|
full = await repo.branches.getAheadOfBase?.(branch, void 0, signal);
|
|
900
923
|
} catch (ex) {
|
|
901
|
-
if (
|
|
924
|
+
if (isReadAborted(ex, signal)) throw ex;
|
|
902
925
|
}
|
|
903
926
|
verifyBaseRemeasure(aheadOfBase, full);
|
|
904
927
|
}
|
|
@@ -908,7 +931,7 @@ async function readSummary(repo, key, fields, previous, previousBaseKeys, previo
|
|
|
908
931
|
dependsOn = aheadOfBase?.dependsOn ?? emptyRefs;
|
|
909
932
|
baseDefaultBranch = aheadOfBase?.defaultBranch;
|
|
910
933
|
} catch (ex) {
|
|
911
|
-
if (
|
|
934
|
+
if (isReadAborted(ex, signal)) throw ex;
|
|
912
935
|
baseFailed = true;
|
|
913
936
|
baseError = ex;
|
|
914
937
|
const sameBranch = previous != null && branch === previous.branch && detached === previous.detached;
|
|
@@ -946,6 +969,13 @@ async function readSummary(repo, key, fields, previous, previousBaseKeys, previo
|
|
|
946
969
|
fields
|
|
947
970
|
};
|
|
948
971
|
}
|
|
972
|
+
/**
|
|
973
|
+
* Whether `ex` is the read giving up on `signal`, rather than failing: one cut short (git ran past its time limit, or
|
|
974
|
+
* was killed) rejects as a cancellation too, with `signal` not aborted
|
|
975
|
+
*/
|
|
976
|
+
function isReadAborted(ex, signal) {
|
|
977
|
+
return isCancellationError(ex) && (signal?.aborted ?? true);
|
|
978
|
+
}
|
|
949
979
|
async function getGitDir(repo) {
|
|
950
980
|
try {
|
|
951
981
|
return await repo.config.getGitDir?.();
|
|
@@ -1079,7 +1109,7 @@ async function readRemoteHeads(repo, heads, remotes, signal) {
|
|
|
1079
1109
|
try {
|
|
1080
1110
|
target = await repo.branches.getDefaultBranchName(name, { local: true }, signal);
|
|
1081
1111
|
} catch (ex) {
|
|
1082
|
-
if (
|
|
1112
|
+
if (isReadAborted(ex, signal)) throw ex;
|
|
1083
1113
|
target = null;
|
|
1084
1114
|
}
|
|
1085
1115
|
heads.set(name, target);
|
|
@@ -1133,7 +1163,7 @@ async function readBaseConfig(repo, signal) {
|
|
|
1133
1163
|
if (repo.branches.getAheadOfBaseConfigEntries != null) return await repo.branches.getAheadOfBaseConfigEntries(signal);
|
|
1134
1164
|
return await repo.branches.getAheadOfBaseConfigKey?.(signal);
|
|
1135
1165
|
} catch (ex) {
|
|
1136
|
-
if (
|
|
1166
|
+
if (isReadAborted(ex, signal)) throw ex;
|
|
1137
1167
|
return;
|
|
1138
1168
|
}
|
|
1139
1169
|
}
|