Adds experimental 'Stash Changes' command

Adds experimental 'Stash Changes' to stash list
Adds experimental 'Stash Unstaged Changes' to stash list
This commit is contained in:
Eric Amodio
2017-03-29 01:31:31 -04:00
parent e3c9fd53ca
commit d8564c215c
11 changed files with 83 additions and 8 deletions

View File

@@ -78,7 +78,7 @@ export class CommitDetailsQuickPick {
if (stash && git.config.insiders) {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(repo-forked) Apply Stashed Changes`,
label: `$(git-pull-request) Apply Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
}, Commands.StashApply, [commit as GitStashCommit, true, false]));

View File

@@ -1,15 +1,27 @@
'use strict';
import { Iterables } from '../system';
import { QuickPickOptions, window } from 'vscode';
import { Keyboard } from '../commands';
import { IGitStash } from '../gitService';
import { Commands, Keyboard } from '../commands';
import { GitService, IGitStash } from '../gitService';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks';
export class StashListQuickPick {
static async show(stash: IGitStash, placeHolder?: string, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
static async show(git: GitService, stash: IGitStash, mode: 'list' | 'apply', goBackCommand?: 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]));
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-push) Stash Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 stashes all changes`
}, Commands.StashSave));
}
if (goBackCommand) {
items.splice(0, 0, goBackCommand);
}
@@ -18,7 +30,9 @@ export class StashListQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: placeHolder || `stashed changes \u2014 search by message, filename, or sha`,
placeHolder: mode === 'apply'
? `Apply stashed changes to your working tree\u2026`
: `stashed changes \u2014 search by message, filename, or sha`,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
// onDidSelectItem: (item: QuickPickItem) => {
// scope.setKeyCommand('right', item);