|
|
@ -2747,111 +2747,6 @@ export class LocalGitProvider implements GitProvider, Disposable { |
|
|
|
return GitUri.fromFile(file ?? fileName, repoPath, previousRef ?? GitRevision.deletedOrMissing); |
|
|
|
} |
|
|
|
|
|
|
|
async getPullRequestForBranch( |
|
|
|
branch: string, |
|
|
|
remote: GitRemote, |
|
|
|
options?: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number }, |
|
|
|
): Promise<PullRequest | undefined>; |
|
|
|
async getPullRequestForBranch( |
|
|
|
branch: string, |
|
|
|
provider: RichRemoteProvider, |
|
|
|
options?: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number }, |
|
|
|
): Promise<PullRequest | undefined>; |
|
|
|
@gate<LocalGitProvider['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<LocalGitProvider['getPullRequestForBranch']>({ args: { 1: remoteOrProvider => remoteOrProvider.name } }) |
|
|
|
async getPullRequestForBranch( |
|
|
|
branch: string, |
|
|
|
remoteOrProvider: GitRemote | RichRemoteProvider, |
|
|
|
{ |
|
|
|
timeout, |
|
|
|
...options |
|
|
|
}: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number } = {}, |
|
|
|
): Promise<PullRequest | undefined> { |
|
|
|
let provider; |
|
|
|
if (GitRemote.is(remoteOrProvider)) { |
|
|
|
({ provider } = remoteOrProvider); |
|
|
|
if (!provider?.hasRichApi()) return undefined; |
|
|
|
} else { |
|
|
|
provider = remoteOrProvider; |
|
|
|
} |
|
|
|
|
|
|
|
let promiseOrPR = provider.getPullRequestForBranch(branch, options); |
|
|
|
if (promiseOrPR == null || !Promises.is(promiseOrPR)) { |
|
|
|
return promiseOrPR; |
|
|
|
} |
|
|
|
|
|
|
|
if (timeout != null && timeout > 0) { |
|
|
|
promiseOrPR = Promises.cancellable(promiseOrPR, timeout); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
return await promiseOrPR; |
|
|
|
} catch (ex) { |
|
|
|
if (ex instanceof Promises.CancellationError) { |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
|
|
|
|
return undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async getPullRequestForCommit( |
|
|
|
ref: string, |
|
|
|
remote: GitRemote, |
|
|
|
options?: { timeout?: number }, |
|
|
|
): Promise<PullRequest | undefined>; |
|
|
|
async getPullRequestForCommit( |
|
|
|
ref: string, |
|
|
|
provider: RichRemoteProvider, |
|
|
|
options?: { timeout?: number }, |
|
|
|
): Promise<PullRequest | undefined>; |
|
|
|
@gate<LocalGitProvider['getPullRequestForCommit']>((ref, remoteOrProvider, options) => { |
|
|
|
const provider = GitRemote.is(remoteOrProvider) ? remoteOrProvider.provider : remoteOrProvider; |
|
|
|
return `${ref}${provider != null ? `|${provider.id}:${provider.domain}/${provider.path}` : ''}|${ |
|
|
|
options?.timeout |
|
|
|
}`;
|
|
|
|
}) |
|
|
|
@debug<LocalGitProvider['getPullRequestForCommit']>({ args: { 1: remoteOrProvider => remoteOrProvider.name } }) |
|
|
|
async getPullRequestForCommit( |
|
|
|
ref: string, |
|
|
|
remoteOrProvider: GitRemote | RichRemoteProvider, |
|
|
|
options?: { timeout?: number }, |
|
|
|
): Promise<PullRequest | undefined> { |
|
|
|
if (GitRevision.isUncommitted(ref)) return undefined; |
|
|
|
|
|
|
|
let provider; |
|
|
|
if (GitRemote.is(remoteOrProvider)) { |
|
|
|
({ provider } = remoteOrProvider); |
|
|
|
if (!provider?.hasRichApi()) return undefined; |
|
|
|
} else { |
|
|
|
provider = remoteOrProvider; |
|
|
|
} |
|
|
|
|
|
|
|
let promiseOrPR = provider.getPullRequestForCommit(ref); |
|
|
|
if (promiseOrPR == null || !Promises.is(promiseOrPR)) { |
|
|
|
return promiseOrPR; |
|
|
|
} |
|
|
|
|
|
|
|
if (options?.timeout != null && options.timeout > 0) { |
|
|
|
promiseOrPR = Promises.cancellable(promiseOrPR, options.timeout); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
return await promiseOrPR; |
|
|
|
} catch (ex) { |
|
|
|
if (ex instanceof Promises.CancellationError) { |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
|
|
|
|
return undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async getIncomingActivity( |
|
|
|
repoPath: string, |
|
|
|