Extract remote source provider registry into the vscode.git-base extension (#137656)

This commit is contained in:
Ladislau Szomoru
2021-11-24 20:48:44 +01:00
committed by GitHub
parent 483d6f15ed
commit bfad20be9d
35 changed files with 946 additions and 258 deletions

View File

@@ -3,10 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { API as GitAPI, RemoteSourceProvider, RemoteSource, Repository } from './typings/git';
import { RemoteSourceProvider, RemoteSource } from './typings/git-base';
import { getOctokit } from './auth';
import { Octokit } from '@octokit/rest';
import { publishRepository } from './publish';
function parse(url: string): { owner: string, repo: string } | undefined {
const match = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\.git/i.exec(url)
@@ -30,8 +29,6 @@ export class GithubRemoteSourceProvider implements RemoteSourceProvider {
private userReposCache: RemoteSource[] = [];
constructor(private gitAPI: GitAPI) { }
async getRemoteSources(query?: string): Promise<RemoteSource[]> {
const octokit = await getOctokit();
@@ -108,8 +105,4 @@ export class GithubRemoteSourceProvider implements RemoteSourceProvider {
return branches.sort((a, b) => a === defaultBranch ? -1 : b === defaultBranch ? 1 : 0);
}
publishRepository(repository: Repository): Promise<void> {
return publishRepository(this.gitAPI, repository);
}
}