mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-24 19:56:38 +00:00
Extract remote source provider registry into the vscode.git-base extension (#137656)
This commit is contained in:
@@ -5,12 +5,13 @@
|
||||
|
||||
import { Model } from '../model';
|
||||
import { Repository as BaseRepository, Resource } from '../repository';
|
||||
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, ForcePushMode, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions, RefType, RemoteSourceProvider, CredentialsProvider, BranchQuery, PushErrorHandler, PublishEvent, FetchOptions } from './git';
|
||||
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, ForcePushMode, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions, RefType, CredentialsProvider, BranchQuery, PushErrorHandler, PublishEvent, FetchOptions, RemoteSourceProvider, RemoteSourcePublisher } from './git';
|
||||
import { Event, SourceControlInputBox, Uri, SourceControl, Disposable, commands } from 'vscode';
|
||||
import { mapEvent } from '../util';
|
||||
import { combinedDisposable, mapEvent } from '../util';
|
||||
import { toGitUri } from '../uri';
|
||||
import { pickRemoteSource, PickRemoteSourceOptions } from '../remoteSource';
|
||||
import { GitExtensionImpl } from './extension';
|
||||
import { GitBaseApi } from '../git-base';
|
||||
import { PickRemoteSourceOptions } from './git-base';
|
||||
|
||||
class ApiInputBox implements InputBox {
|
||||
set value(value: string) { this._inputBox.value = value; }
|
||||
@@ -283,7 +284,18 @@ export class ApiImpl implements API {
|
||||
}
|
||||
|
||||
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable {
|
||||
return this._model.registerRemoteSourceProvider(provider);
|
||||
const disposables: Disposable[] = [];
|
||||
|
||||
if (provider.publishRepository) {
|
||||
disposables.push(this._model.registerRemoteSourcePublisher(provider as RemoteSourcePublisher));
|
||||
}
|
||||
disposables.push(GitBaseApi.getAPI().registerRemoteSourceProvider(provider));
|
||||
|
||||
return combinedDisposable(disposables);
|
||||
}
|
||||
|
||||
registerRemoteSourcePublisher(publisher: RemoteSourcePublisher): Disposable {
|
||||
return this._model.registerRemoteSourcePublisher(publisher);
|
||||
}
|
||||
|
||||
registerCredentialsProvider(provider: CredentialsProvider): Disposable {
|
||||
@@ -370,11 +382,7 @@ export function registerAPICommands(extension: GitExtensionImpl): Disposable {
|
||||
}));
|
||||
|
||||
disposables.push(commands.registerCommand('git.api.getRemoteSources', (opts?: PickRemoteSourceOptions) => {
|
||||
if (!extension.model) {
|
||||
return;
|
||||
}
|
||||
|
||||
return pickRemoteSource(extension.model, opts as any);
|
||||
return commands.executeCommand('git-base.api.getRemoteSources', opts);
|
||||
}));
|
||||
|
||||
return Disposable.from(...disposables);
|
||||
|
||||
Reference in New Issue
Block a user