Browse Source

Fixes gates

main
Eric Amodio 3 years ago
parent
commit
e556d3302d
2 changed files with 13 additions and 5 deletions
  1. +11
    -3
      src/git/gitService.ts
  2. +2
    -2
      src/git/models/commit.ts

+ 11
- 3
src/git/gitService.ts View File

@ -3045,7 +3045,12 @@ export class GitService implements Disposable {
provider: RichRemoteProvider,
options?: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number },
): Promise<PullRequest | undefined>;
@gate()
@gate<GitService['getPullRequestForBranch']>((ref, remoteOrProvider, options) => {
const provider = GitRemote.is(remoteOrProvider) ? remoteOrProvider.provider : remoteOrProvider;
return `${ref}${provider != null ? `|${provider.id}:${provider.domain}/${provider.path}` : ''}${
options != null ? `|${options.limit ?? -1}:${options.include?.join(',')}` : ''
}`;
})
@debug<GitService['getPullRequestForBranch']>({
args: {
1: (remoteOrProvider: GitRemote | RichRemoteProvider) => remoteOrProvider.name,
@ -3097,8 +3102,11 @@ export class GitService implements Disposable {
provider: RichRemoteProvider,
options?: { timeout?: number },
): Promise<PullRequest | undefined>;
@gate()
@debug({
@gate<GitService['getPullRequestForCommit']>((ref, remoteOrProvider) => {
const provider = GitRemote.is(remoteOrProvider) ? remoteOrProvider.provider : remoteOrProvider;
return `${ref}${provider != null ? `|${provider.id}:${provider.domain}/${provider.path}` : ''}`;
})
@debug<GitService['getPullRequestForCommit']>({
args: {
1: (remoteOrProvider: GitRemote | RichRemoteProvider) => remoteOrProvider.name,
},

+ 2
- 2
src/git/models/commit.ts View File

@ -147,11 +147,11 @@ export abstract class GitCommit implements GitRevisionReference {
}
@memoize()
async getAssociatedPullRequest(): Promise<PullRequest | undefined> {
async getAssociatedPullRequest(options?: { timeout?: number }): Promise<PullRequest | undefined> {
const remote = await Container.git.getRichRemoteProvider(this.repoPath);
if (remote?.provider == null) return undefined;
return Container.git.getPullRequestForCommit(this.ref, remote);
return Container.git.getPullRequestForCommit(this.ref, remote, options);
}
@memoize<GitCommit['getPreviousLineDiffUris']>(

Loading…
Cancel
Save