|
1 | 1 | import type { CancellationToken } from 'vscode';
|
2 | 2 | import type { Container } from '../../../../container';
|
3 | 3 | import type { GitCache } from '../../../../git/cache';
|
| 4 | +import type { GitRemotesSubProvider } from '../../../../git/gitProvider'; |
4 | 5 | import type { GitRemote } from '../../../../git/models/remote';
|
5 | 6 | import { sortRemotes } from '../../../../git/models/remote';
|
6 | 7 | import { parseGitRemotes } from '../../../../git/parsers/remoteParser';
|
7 | 8 | import { getRemoteProviderMatcher, loadRemoteProviders } from '../../../../git/remotes/remoteProviders';
|
8 | 9 | import { RemotesGitProviderBase } from '../../../../git/sub-providers/remotes';
|
| 10 | +import { gate } from '../../../../system/decorators/gate'; |
9 | 11 | import { log } from '../../../../system/decorators/log';
|
10 | 12 | import { Logger } from '../../../../system/logger';
|
11 | 13 | import { getLogScope } from '../../../../system/logger.scope';
|
12 | 14 | import { configuration } from '../../../../system/vscode/configuration';
|
13 | 15 | import type { Git } from '../git';
|
14 | 16 | import type { LocalGitProvider } from '../localGitProvider';
|
15 | 17 |
|
16 |
| -export class RemotesGitSubProvider extends RemotesGitProviderBase { |
| 18 | +export class RemotesGitSubProvider extends RemotesGitProviderBase implements GitRemotesSubProvider { |
17 | 19 | constructor(
|
18 | 20 | container: Container,
|
19 | 21 | private readonly git: Git,
|
@@ -72,4 +74,25 @@ export class RemotesGitSubProvider extends RemotesGitProviderBase {
|
72 | 74 |
|
73 | 75 | return remotes;
|
74 | 76 | }
|
| 77 | + |
| 78 | + @gate() |
| 79 | + @log() |
| 80 | + async addRemote(repoPath: string, name: string, url: string, options?: { fetch?: boolean }): Promise<void> { |
| 81 | + await this.git.remote__add(repoPath, name, url, options); |
| 82 | + this.container.events.fire('git:cache:reset', { repoPath: repoPath, caches: ['remotes'] }); |
| 83 | + } |
| 84 | + |
| 85 | + @gate() |
| 86 | + @log() |
| 87 | + async pruneRemote(repoPath: string, name: string): Promise<void> { |
| 88 | + await this.git.remote__prune(repoPath, name); |
| 89 | + this.container.events.fire('git:cache:reset', { repoPath: repoPath, caches: ['remotes'] }); |
| 90 | + } |
| 91 | + |
| 92 | + @gate() |
| 93 | + @log() |
| 94 | + async removeRemote(repoPath: string, name: string): Promise<void> { |
| 95 | + await this.git.remote__remove(repoPath, name); |
| 96 | + this.container.events.fire('git:cache:reset', { repoPath: repoPath, caches: ['remotes'] }); |
| 97 | + } |
75 | 98 | }
|
0 commit comments