@gitkraken/core-gitlens 0.33.0 → 0.35.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 +23 -1
- package/dist/git/cache.d.ts +31 -0
- package/dist/git/cache.js +101 -30
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +3 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/errors.d.ts +3 -1
- package/dist/git/errors.js +4 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +90 -1
- package/dist/git/models/pullRequest.js +18 -2
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/providers/shared/remotes.js +2 -0
- package/dist/git/providers/shared/remotes.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts +72 -1
- package/dist/git/utils/pullRequest.utils.js +99 -1
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/utils/repository.utils.d.ts +6 -0
- package/dist/git/utils/repository.utils.js +14 -2
- package/dist/git/utils/repository.utils.js.map +1 -1
- package/dist/git/watching/gitDirPoller.d.ts +10 -1
- package/dist/git/watching/gitDirPoller.js +9 -3
- package/dist/git/watching/gitDirPoller.js.map +1 -1
- package/dist/git/watching/unwatchedCacheValidator.d.ts +144 -0
- package/dist/git/watching/unwatchedCacheValidator.js +884 -0
- package/dist/git/watching/unwatchedCacheValidator.js.map +1 -0
- package/dist/git/watching/watchGroup.d.ts +2 -0
- package/dist/git/watching/watchGroup.js +4 -8
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +23 -0
- package/dist/git/watching/watchService.js +42 -2
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +2 -0
- package/dist/git/watching/watchSession.js +3 -2
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +1 -1
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +31 -1
- package/dist/git-cli/exec/commandClassifier.js +67 -16
- package/dist/git-cli/exec/commandClassifier.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +46 -2
- package/dist/git-cli/exec/git.js +80 -7
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitDirResolver.d.ts +11 -0
- package/dist/git-cli/exec/gitDirResolver.js +34 -1
- package/dist/git-cli/exec/gitDirResolver.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.js +2 -28
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +1 -0
- package/dist/git-cli/providers/branches.js +6 -0
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +13 -1
- package/dist/git-cli/providers/config.js +48 -14
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +1 -0
- package/dist/git-cli/providers/pausedOperations.js +4 -0
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/revision.js +2 -0
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/worktrees.js +2 -0
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts +25 -1
- package/dist/git-cli/service.js +45 -0
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/ai/errors.d.ts +8 -2
- package/dist/plus/ai/errors.js +15 -3
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/git-github/api/config.d.ts +11 -0
- package/dist/plus/git-github/api/config.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +82 -1
- package/dist/plus/git-github/api/github.js +304 -7
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +61 -1
- package/dist/plus/git-github/models.js +49 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +12 -0
- package/dist/plus/integrations/fieldPresence.d.ts +16 -1
- package/dist/plus/integrations/fieldPresence.js +37 -10
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +12 -0
- package/dist/plus/integrations/integrationService.js +4 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +38 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +41 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +51 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +23 -2
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.js +2 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +21 -1
- package/dist/plus/integrations/providers/github.js +71 -6
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +7 -0
- package/dist/plus/integrations/reads/drains.d.ts +1 -1
- package/dist/plus/integrations/reads/drains.js +2 -1
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/etag.js +13 -0
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +6 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js +9 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +3 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequests.js +2 -1
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
- package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/docs/integrations.md +77 -15
- package/package.json +1 -1
|
@@ -186,6 +186,13 @@ type PullRequestSweepCommonOptions = {
|
|
|
186
186
|
* remotes. Defaults to `true`; other providers ignore it.
|
|
187
187
|
*/
|
|
188
188
|
includeRemoteInfo?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Selects merge-queue data (`mergeQueue`, `mergeQueueRequired`, `mergeQueueRemoval`) on GitHub.com for this
|
|
191
|
+
* read: `true` selects it, `false` doesn't, omitted follows the host's `ConfigProvider.getPullRequestReadOptions`.
|
|
192
|
+
* Account-wide targets only; a repo-scoped read goes through provider-apis, which selects none, and every other
|
|
193
|
+
* provider ignores it. Selecting it costs a rate-limit request per row.
|
|
194
|
+
*/
|
|
195
|
+
mergeQueue?: boolean;
|
|
189
196
|
/**
|
|
190
197
|
* Page budget per provider. A stop at this budget with a resumable cursor is reported as
|
|
191
198
|
* `pagination-incomplete` with `recovery: 'page-budget'`. A part no budget reaches is reported beside it
|
|
@@ -421,6 +428,14 @@ export interface IntegrationManager {
|
|
|
421
428
|
* checked out or matched to local remotes. Defaults to `true`; other providers ignore it.
|
|
422
429
|
*/
|
|
423
430
|
includeRemoteInfo?: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* Selects merge-queue data (`mergeQueue`, `mergeQueueRequired`, `mergeQueueRemoval`) on GitHub.com for this
|
|
433
|
+
* read: `true` selects it, `false` doesn't, omitted follows the host's
|
|
434
|
+
* `ConfigProvider.getPullRequestReadOptions`. Account-wide only (no `repos`); the repo-scoped read goes through
|
|
435
|
+
* provider-apis, which selects none, and every other provider ignores it. Selecting it costs a rate-limit
|
|
436
|
+
* request per row.
|
|
437
|
+
*/
|
|
438
|
+
mergeQueue?: boolean;
|
|
424
439
|
}): Promise<ProviderPagedResult<PullRequestShape>>;
|
|
425
440
|
/**
|
|
426
441
|
* Pull requests matching structured criteria over a repository/organization or current-user relationship
|
|
@@ -508,6 +523,13 @@ export interface IntegrationManager {
|
|
|
508
523
|
* rather than a contract about which fields are present.
|
|
509
524
|
*/
|
|
510
525
|
summary?: boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Selects merge-queue data (`mergeQueue`, `mergeQueueRequired`, `mergeQueueRemoval`) on GitHub.com for this
|
|
528
|
+
* read: `true` selects it, `false` doesn't, omitted follows the host's
|
|
529
|
+
* `ConfigProvider.getPullRequestReadOptions`. Every other provider ignores it. Selecting it costs a
|
|
530
|
+
* rate-limit request per row.
|
|
531
|
+
*/
|
|
532
|
+
mergeQueue?: boolean;
|
|
511
533
|
}): Promise<ProviderPagedResult<PullRequestShape>>;
|
|
512
534
|
listIssuesPage(options: {
|
|
513
535
|
state?: IssueStateFilter;
|
|
@@ -796,6 +818,15 @@ export interface IntegrationManager {
|
|
|
796
818
|
* computed (and the cheap check's selection); the full read is the same.
|
|
797
819
|
*/
|
|
798
820
|
etagIncludes?: readonly PullRequestEtagInclude[];
|
|
821
|
+
/**
|
|
822
|
+
* Selects merge-queue data (`mergeQueue`, `mergeQueueRequired`, `mergeQueueRemoval`) on GitHub.com, in the cheap
|
|
823
|
+
* check and the full read alike: `true` selects it, `false` doesn't, omitted follows the host's
|
|
824
|
+
* `ConfigProvider.getPullRequestReadOptions`, resolved once per call. Every other provider ignores it. A read
|
|
825
|
+
* that selects it adds a marker to every etag it computes, so its etags and those of a read that doesn't never
|
|
826
|
+
* compare equal: changing this, or the host setting, reads each held target in full once. Selecting it costs a
|
|
827
|
+
* rate-limit request per row, in the cheap check as well as the full read.
|
|
828
|
+
*/
|
|
829
|
+
mergeQueue?: boolean;
|
|
799
830
|
}): Promise<ProviderResult<PullRequestBatchResult>>;
|
|
800
831
|
/**
|
|
801
832
|
* Finds, for each branch, every pull request whose head is that branch — in any state (open, closed or merged),
|
|
@@ -841,6 +872,13 @@ export interface IntegrationManager {
|
|
|
841
872
|
connectionId?: string;
|
|
842
873
|
/** Self-managed host domain fallback; see {@link ProviderSweepTarget.domain}. */
|
|
843
874
|
domain?: string;
|
|
875
|
+
/**
|
|
876
|
+
* Selects merge-queue data (`mergeQueue`, `mergeQueueRequired`, `mergeQueueRemoval`) on GitHub.com for this
|
|
877
|
+
* read: `true` selects it, `false` doesn't, omitted follows the host's
|
|
878
|
+
* `ConfigProvider.getPullRequestReadOptions`, resolved once per call. Every other provider ignores it.
|
|
879
|
+
* Selecting it costs a rate-limit request per row (a 25-branch chunk 13 points instead of 10 without).
|
|
880
|
+
*/
|
|
881
|
+
mergeQueue?: boolean;
|
|
844
882
|
}): Promise<ProviderResult<PullRequestBranchResult>>;
|
|
845
883
|
/**
|
|
846
884
|
* How many pull requests match each scope — the PR twin of {@link countIssues}, behind a "this will fetch ~N pull
|
|
@@ -2,7 +2,7 @@ import { PagedResult } from "../../../utils/paging.js";
|
|
|
2
2
|
import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
|
|
3
3
|
import { IssueOrPullRequestState } from "../../../git/models/issueOrPullRequest.js";
|
|
4
4
|
import { IssueSearchCriteria, IssueShape } from "../../../git/models/issue.js";
|
|
5
|
-
import { PullRequest, PullRequestFilter, PullRequestMergeMethod, PullRequestSearchCriteria, PullRequestShape, PullRequestStackInfo, PullRequestStackLayers, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
|
|
5
|
+
import { PullRequest, PullRequestFilter, PullRequestMergeMethod, PullRequestMergeQueueActionResult, PullRequestMergeQueueEntry, PullRequestSearchCriteria, PullRequestShape, PullRequestStackInfo, PullRequestStackLayers, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
|
|
6
6
|
import { Account as Account$1, UnidentifiedAuthor } from "../../../git/models/author.js";
|
|
7
7
|
import { DefaultBranch } from "../../../git/models/defaultBranch.js";
|
|
8
8
|
import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
@@ -174,6 +174,10 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
174
174
|
/** Stack membership for every stacked pull request in the repository, keyed by pull request number.
|
|
175
175
|
* Only hosts with a stacks concept implement this (currently GitHub). */
|
|
176
176
|
getStacksByPullRequestNumber?(owner: string, repo: string, cancellation?: AbortSignal): Promise<Map<number, PullRequestStackInfo> | undefined>;
|
|
177
|
+
/** Merge-queue entries for the given base branches of the repository, keyed by pull request number, for rows from a
|
|
178
|
+
* read that selects no merge queue. Only hosts with a readable merge queue implement this (currently GitHub.com);
|
|
179
|
+
* `undefined` means unavailable. INTERIM: remove once provider-apis carries the entry on its rows (goals S6). */
|
|
180
|
+
getMergeQueueEntriesByPullRequestNumber?(owner: string, repo: string, branches: readonly string[], cancellation?: AbortSignal): Promise<Map<number, PullRequestMergeQueueEntry> | undefined>;
|
|
177
181
|
/** The ordered layers of the stack the given pull request belongs to, bottom to top. `undefined`
|
|
178
182
|
* when the host has no stacks concept, the repository isn't enrolled, or the pull request isn't
|
|
179
183
|
* stacked. */
|
|
@@ -282,6 +286,27 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
282
286
|
protected abstract mergeProviderPullRequest(session: ProviderAuthenticationSession, pr: PullRequest, options?: {
|
|
283
287
|
mergeMethod?: PullRequestMergeMethod;
|
|
284
288
|
}, cancellation?: AbortSignal): Promise<boolean>;
|
|
289
|
+
/**
|
|
290
|
+
* Adds a pull request to its base branch's merge queue (where `mergeQueueRequired` says merging means queueing).
|
|
291
|
+
* The result says why on failure: the host's refusal (`already-queued`, `head-changed`, `permission`, …),
|
|
292
|
+
* `unsupported` where this host has no merge queue to act on (only GitHub.com's is), or `unknown` for anything
|
|
293
|
+
* else, including no connection or a failure to reach the host — the provider's message rides along for logs, not
|
|
294
|
+
* for display. Cancellation throws `CancellationError`. Evicts cached pull requests whatever the outcome, as
|
|
295
|
+
* {@link mergePullRequest} does.
|
|
296
|
+
*/
|
|
297
|
+
enqueuePullRequest(pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
298
|
+
/**
|
|
299
|
+
* Removes a queued pull request from its base branch's merge queue, losing its place there. Results, failures and
|
|
300
|
+
* cancellation as {@link enqueuePullRequest}.
|
|
301
|
+
*/
|
|
302
|
+
dequeuePullRequest(pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
303
|
+
/** {@link mergePullRequest}'s session and failure handling, for the merge-queue actions. */
|
|
304
|
+
private runMergeQueueAction;
|
|
305
|
+
/** Implemented only by hosts whose merge queue this integration can act on (currently GitHub.com); the base
|
|
306
|
+
* reports `unsupported` without one. */
|
|
307
|
+
protected enqueueProviderPullRequest?(session: ProviderAuthenticationSession, pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
308
|
+
/** See {@link enqueueProviderPullRequest}. */
|
|
309
|
+
protected dequeueProviderPullRequest?(session: ProviderAuthenticationSession, pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
285
310
|
getPullRequestForBranch(repo: T, branch: string, options?: {
|
|
286
311
|
avatarSize?: number;
|
|
287
312
|
expiryOverride?: boolean | number;
|
|
@@ -380,6 +405,10 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
380
405
|
filters?: PullRequestFilter[];
|
|
381
406
|
/** Request only the stable list fields, omitting optional provider enrichments. */
|
|
382
407
|
summary?: boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Selects merge-queue data on GitHub.com for this read, over the host's default; other providers ignore it.
|
|
410
|
+
*/
|
|
411
|
+
mergeQueue?: boolean;
|
|
383
412
|
}, connectionId?: string): Promise<IntegrationResult<ProviderApiPagedResult<ProviderPullRequest | PullRequest> | undefined>>;
|
|
384
413
|
/**
|
|
385
414
|
* Reads the current user's pull requests across the whole account using each provider's native "my PRs"
|
|
@@ -403,6 +432,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
403
432
|
includeReviewRequested?: boolean;
|
|
404
433
|
filters?: PullRequestFilter[];
|
|
405
434
|
summary?: boolean;
|
|
435
|
+
mergeQueue?: boolean;
|
|
406
436
|
}): Promise<ProviderApiPagedResult<ProviderPullRequest | PullRequest> | undefined>;
|
|
407
437
|
/**
|
|
408
438
|
* The current account as each of `pullRequests` identifies its members, in order: what a raw row's
|
|
@@ -446,6 +476,8 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
446
476
|
pageSize?: number;
|
|
447
477
|
/** See {@link IntegrationManager.searchPullRequestsPage}. */
|
|
448
478
|
summary?: boolean;
|
|
479
|
+
/** See {@link IntegrationManager.searchPullRequestsPage}. */
|
|
480
|
+
mergeQueue?: boolean;
|
|
449
481
|
}, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<ProviderPullRequestSearchPage | undefined>>;
|
|
450
482
|
/** Must agree with `ProviderMetadata.supportedPullRequestSearch`. */
|
|
451
483
|
protected searchProviderPullRequestsPage?(session: ProviderAuthenticationSession, options: {
|
|
@@ -456,6 +488,8 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
456
488
|
pageSize?: number;
|
|
457
489
|
/** See the caller's option of the same name on {@link searchPullRequestsPage}. */
|
|
458
490
|
summary?: boolean;
|
|
491
|
+
/** See the caller's option of the same name on {@link searchPullRequestsPage}. */
|
|
492
|
+
mergeQueue?: boolean;
|
|
459
493
|
}, cancellation?: AbortSignal): Promise<ProviderPullRequestSearchPage | undefined>;
|
|
460
494
|
/** Free-text search across pull requests, optionally narrowed to `repos`. */
|
|
461
495
|
searchPullRequests(searchQuery: string, repos?: T | T[], cancellation?: AbortSignal, options?: SearchPullRequestsOptions & {
|
|
@@ -593,6 +627,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
593
627
|
id: string;
|
|
594
628
|
username?: string;
|
|
595
629
|
};
|
|
630
|
+
mergeQueue?: boolean;
|
|
596
631
|
}, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestShape | undefined>[] | undefined>>;
|
|
597
632
|
/**
|
|
598
633
|
* OPTIONAL: resolves several coordinates, returning one settled slot per input coordinate, in order, in the
|
|
@@ -614,6 +649,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
614
649
|
id: string;
|
|
615
650
|
username?: string;
|
|
616
651
|
};
|
|
652
|
+
mergeQueue?: boolean;
|
|
617
653
|
} | undefined, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestShape | undefined>[] | undefined>;
|
|
618
654
|
/**
|
|
619
655
|
* Result-returning wrapper for the cheap check behind the batch issue read's etags: each coordinate's change
|
|
@@ -667,6 +703,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
667
703
|
project?: string;
|
|
668
704
|
}[], options: {
|
|
669
705
|
etagIncludes?: readonly PullRequestEtagInclude[];
|
|
706
|
+
mergeQueue?: boolean;
|
|
670
707
|
}, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestEtagFields | undefined>[] | undefined>>;
|
|
671
708
|
/**
|
|
672
709
|
* OPTIONAL: the cheap check behind the batch pull request read's etags — one settled slot per input coordinate,
|
|
@@ -682,6 +719,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
682
719
|
project?: string;
|
|
683
720
|
}[], options: {
|
|
684
721
|
etagIncludes?: readonly PullRequestEtagInclude[];
|
|
722
|
+
mergeQueue?: boolean;
|
|
685
723
|
}, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestEtagFields | undefined>[] | undefined>;
|
|
686
724
|
/**
|
|
687
725
|
* Result-returning wrapper for the pull-requests-by-branch read: for each target, every pull request whose head
|
|
@@ -710,6 +748,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
710
748
|
username?: string;
|
|
711
749
|
};
|
|
712
750
|
limit: number;
|
|
751
|
+
mergeQueue?: boolean;
|
|
713
752
|
}, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<{
|
|
714
753
|
pullRequests: PullRequestShape[];
|
|
715
754
|
truncated: boolean;
|
|
@@ -738,6 +777,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
738
777
|
username?: string;
|
|
739
778
|
};
|
|
740
779
|
limit: number;
|
|
780
|
+
mergeQueue?: boolean;
|
|
741
781
|
}, cancellation?: AbortSignal): Promise<PromiseSettledResult<{
|
|
742
782
|
pullRequests: PullRequestShape[];
|
|
743
783
|
truncated: boolean;
|
|
@@ -472,6 +472,55 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
472
472
|
this.ctx.cache.deletePullRequests();
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Adds a pull request to its base branch's merge queue (where `mergeQueueRequired` says merging means queueing).
|
|
477
|
+
* The result says why on failure: the host's refusal (`already-queued`, `head-changed`, `permission`, …),
|
|
478
|
+
* `unsupported` where this host has no merge queue to act on (only GitHub.com's is), or `unknown` for anything
|
|
479
|
+
* else, including no connection or a failure to reach the host — the provider's message rides along for logs, not
|
|
480
|
+
* for display. Cancellation throws `CancellationError`. Evicts cached pull requests whatever the outcome, as
|
|
481
|
+
* {@link mergePullRequest} does.
|
|
482
|
+
*/
|
|
483
|
+
async enqueuePullRequest(pr, cancellation) {
|
|
484
|
+
const scope = getScopedLogger();
|
|
485
|
+
return this.runMergeQueueAction("enqueuePullRequest", this.enqueueProviderPullRequest?.bind(this), pr, cancellation, scope);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Removes a queued pull request from its base branch's merge queue, losing its place there. Results, failures and
|
|
489
|
+
* cancellation as {@link enqueuePullRequest}.
|
|
490
|
+
*/
|
|
491
|
+
async dequeuePullRequest(pr, cancellation) {
|
|
492
|
+
const scope = getScopedLogger();
|
|
493
|
+
return this.runMergeQueueAction("dequeuePullRequest", this.dequeueProviderPullRequest?.bind(this), pr, cancellation, scope);
|
|
494
|
+
}
|
|
495
|
+
/** {@link mergePullRequest}'s session and failure handling, for the merge-queue actions. */
|
|
496
|
+
async runMergeQueueAction(syncReqUsecase, action, pr, cancellation, scope) {
|
|
497
|
+
if (action == null) return {
|
|
498
|
+
status: "failed",
|
|
499
|
+
reason: "unsupported"
|
|
500
|
+
};
|
|
501
|
+
const sessionFailure = await this.prepareSessionLookup();
|
|
502
|
+
if (sessionFailure != null) return {
|
|
503
|
+
status: "failed",
|
|
504
|
+
reason: "unknown",
|
|
505
|
+
message: sessionFailure === "unconnected" ? "Not connected" : sessionFailure.message
|
|
506
|
+
};
|
|
507
|
+
try {
|
|
508
|
+
const result = await action(this._session, pr, cancellation);
|
|
509
|
+
this.resetRequestExceptionCount(syncReqUsecase);
|
|
510
|
+
return result;
|
|
511
|
+
} catch (ex) {
|
|
512
|
+
if (isCancellationError(ex)) throw ex;
|
|
513
|
+
const error = toError(ex);
|
|
514
|
+
this.handleProviderException(syncReqUsecase, error, { scope });
|
|
515
|
+
return {
|
|
516
|
+
status: "failed",
|
|
517
|
+
reason: "unknown",
|
|
518
|
+
message: error.message
|
|
519
|
+
};
|
|
520
|
+
} finally {
|
|
521
|
+
this.ctx.cache.deletePullRequests();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
475
524
|
async getPullRequestForBranch(repo, branch, options) {
|
|
476
525
|
const scope = getScopedLogger();
|
|
477
526
|
const refreshFailure = await this.prepareSessionLookup();
|
|
@@ -1633,6 +1682,8 @@ __decorate([trace()], GitHostIntegration.prototype, "getOrganizationsForUserResu
|
|
|
1633
1682
|
__decorate([trace()], GitHostIntegration.prototype, "getProjectsForOrgResult", null);
|
|
1634
1683
|
__decorate([trace()], GitHostIntegration.prototype, "getRepositoriesForOrgResult", null);
|
|
1635
1684
|
__decorate([trace()], GitHostIntegration.prototype, "getRepositoriesForUserResult", null);
|
|
1685
|
+
__decorate([trace()], GitHostIntegration.prototype, "enqueuePullRequest", null);
|
|
1686
|
+
__decorate([trace()], GitHostIntegration.prototype, "dequeuePullRequest", null);
|
|
1636
1687
|
__decorate([trace()], GitHostIntegration.prototype, "getPullRequestForBranch", null);
|
|
1637
1688
|
__decorate([trace()], GitHostIntegration.prototype, "getPullRequestForCommit", null);
|
|
1638
1689
|
__decorate([trace()], GitHostIntegration.prototype, "searchMyPullRequests", null);
|