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

@@ -80,12 +80,12 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-pull-request) Apply Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
}, Commands.StashApply, [commit as GitStashCommit, true, false]));
}, Commands.StashApply, [commit as GitStashCommit, true, false, currentCommand]));
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(x) Delete Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
}, Commands.StashDelete, [commit as GitStashCommit, true]));
}, Commands.StashDelete, [commit as GitStashCommit, true, currentCommand]));
}
if (!stash) {

View File

@@ -7,19 +7,19 @@ import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut }
export class StashListQuickPick {
static async show(git: GitService, stash: IGitStash, mode: 'list' | 'apply', goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
static async show(git: GitService, stash: IGitStash, mode: 'list' | 'apply', goBackCommand?: CommandQuickPickItem, currentCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
const items = ((stash && Array.from(Iterables.map(stash.commits.values(), c => new CommitQuickPickItem(c)))) || []) as (CommitQuickPickItem | CommandQuickPickItem)[];
if (mode === 'list' && git.config.insiders) {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-push) Stash Unstaged Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 stashes only unstaged changes`
}, Commands.StashSave, [undefined, true]));
}, Commands.StashSave, [undefined, true, currentCommand]));
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-push) Stash Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 stashes all changes`
}, Commands.StashSave));
}, Commands.StashSave, [undefined, undefined, currentCommand]));
}
if (goBackCommand) {