Adds go back support to stash apply, delete, & save

This commit is contained in:
Eric Amodio
2017-04-09 01:18:45 -04:00
parent 3aab904aaf
commit 4707b0640d
6 changed files with 31 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ import { MessageItem, window } from 'vscode';
import { GitService } from '../gitService';
import { Command, Commands } from './common';
import { Logger } from '../logger';
import { CommandQuickPickItem } from '../quickPicks';
export class StashDeleteCommand extends Command {
@@ -10,7 +11,7 @@ export class StashDeleteCommand extends Command {
super(Commands.StashDelete);
}
async execute(stashItem: { stashName: string, message: string }, confirm: boolean = true) {
async execute(stashItem: { stashName: string, message: string }, confirm: boolean = true, goBackCommand?: CommandQuickPickItem) {
if (!this.git.config.insiders) return undefined;
if (!this.git.repoPath) return undefined;
if (!stashItem || !stashItem.stashName) return undefined;
@@ -19,7 +20,7 @@ export class StashDeleteCommand extends Command {
if (confirm) {
const message = stashItem.message.length > 80 ? `${stashItem.message.substring(0, 80)}\u2026` : stashItem.message;
const result = await window.showWarningMessage(`Delete stashed changes '${message}'?`, { title: 'Yes' } as MessageItem, { title: 'No', isCloseAffordance: true } as MessageItem);
if (!result || result.title !== 'Yes') return undefined;
if (!result || result.title !== 'Yes') return goBackCommand && goBackCommand.execute();
}
return await this.git.stashDelete(this.git.repoPath, stashItem.stashName);