mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-26 10:15:39 -05:00
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
'use strict';
|
|
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
|
import { Commands, EditorCommand, getCommandUri } from './common';
|
|
import { StashExplorer } from '../views/stashExplorer';
|
|
import { GitService, GitUri } from '../gitService';
|
|
import { Messages } from '../messages';
|
|
import { Logger } from '../logger';
|
|
|
|
export class ShowStashListCommand extends EditorCommand {
|
|
|
|
constructor(private git: GitService, private explorer: StashExplorer) {
|
|
super(Commands.ShowStashList);
|
|
}
|
|
|
|
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri) {
|
|
uri = getCommandUri(uri, editor);
|
|
|
|
try {
|
|
const repoPath = await this.git.getRepoPathFromUri(uri);
|
|
if (!repoPath) return Messages.showNoRepositoryWarningMessage(`Unable to show stashed changes`);
|
|
|
|
this.explorer.update(new GitUri(uri, { repoPath: repoPath, fileName: uri!.fsPath }));
|
|
return undefined;
|
|
}
|
|
catch (ex) {
|
|
Logger.error(ex, 'ShowStashListCommand');
|
|
return window.showErrorMessage(`Unable to show stash list. See output channel for more details`);
|
|
}
|
|
}
|
|
} |