mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
SCM - 💄some follow-up cleanup (#274193)
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LogOutputChannel, SourceControlArtifactProvider, SourceControlArtifactGroup, SourceControlArtifact, Event, EventEmitter, ThemeIcon, l10n, workspace, Uri } from 'vscode';
|
||||
import { IDisposable } from './util';
|
||||
import { LogOutputChannel, SourceControlArtifactProvider, SourceControlArtifactGroup, SourceControlArtifact, Event, EventEmitter, ThemeIcon, l10n, workspace, Uri, Disposable } from 'vscode';
|
||||
import { dispose, IDisposable } from './util';
|
||||
import { Repository } from './repository';
|
||||
|
||||
export class GitArtifactProvider implements SourceControlArtifactProvider, IDisposable {
|
||||
@@ -12,6 +12,7 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp
|
||||
readonly onDidChangeArtifacts: Event<string> = this._onDidChangeArtifacts.event;
|
||||
|
||||
private readonly _groups: SourceControlArtifactGroup[];
|
||||
private readonly _disposables: Disposable[] = [];
|
||||
|
||||
constructor(
|
||||
private readonly repository: Repository,
|
||||
@@ -21,7 +22,10 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp
|
||||
{ id: 'branches', name: l10n.t('Branches'), icon: new ThemeIcon('git-branch') },
|
||||
{ id: 'tags', name: l10n.t('Tags'), icon: new ThemeIcon('tag') }
|
||||
];
|
||||
|
||||
this._disposables.push(this._onDidChangeArtifacts);
|
||||
}
|
||||
|
||||
provideArtifactGroups(): SourceControlArtifactGroup[] {
|
||||
return this._groups;
|
||||
}
|
||||
@@ -58,5 +62,7 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp
|
||||
return [];
|
||||
}
|
||||
|
||||
dispose(): void { }
|
||||
dispose(): void {
|
||||
dispose(this._disposables);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5184,7 +5184,6 @@ export class CommandCenter {
|
||||
|
||||
@command('git.repositories.checkout', { repository: true })
|
||||
async artifactCheckout(repository: Repository, artifact: SourceControlArtifact): Promise<void> {
|
||||
console.log(repository, artifact);
|
||||
if (!repository || !artifact) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -547,27 +547,30 @@ class MainThreadSCMProvider implements ISCMProvider {
|
||||
}
|
||||
|
||||
$onDidChangeHistoryProviderCurrentHistoryItemRefs(historyItemRef?: SCMHistoryItemRefDto, historyItemRemoteRef?: SCMHistoryItemRefDto, historyItemBaseRef?: SCMHistoryItemRefDto): void {
|
||||
if (!this.historyProvider.get()) {
|
||||
const provider = this.historyProvider.get();
|
||||
if (!provider) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._historyProvider.get()?.$onDidChangeCurrentHistoryItemRefs(historyItemRef, historyItemRemoteRef, historyItemBaseRef);
|
||||
provider.$onDidChangeCurrentHistoryItemRefs(historyItemRef, historyItemRemoteRef, historyItemBaseRef);
|
||||
}
|
||||
|
||||
$onDidChangeHistoryProviderHistoryItemRefs(historyItemRefs: SCMHistoryItemRefsChangeEventDto): void {
|
||||
if (!this.historyProvider.get()) {
|
||||
const provider = this.historyProvider.get();
|
||||
if (!provider) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._historyProvider.get()?.$onDidChangeHistoryItemRefs(historyItemRefs);
|
||||
provider.$onDidChangeHistoryItemRefs(historyItemRefs);
|
||||
}
|
||||
|
||||
$onDidChangeArtifacts(group: string): void {
|
||||
if (!this.artifactProvider.get()) {
|
||||
const provider = this.artifactProvider.get();
|
||||
if (!provider) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._artifactProvider.get()?.$onDidChangeArtifacts(group);
|
||||
provider.$onDidChangeArtifacts(group);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
||||
Reference in New Issue
Block a user