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

32
src/commands/stashSave.ts Normal file
View File

@@ -0,0 +1,32 @@
'use strict';
import { InputBoxOptions, window } from 'vscode';
import { GitService } from '../gitService';
import { Command, Commands } from './common';
import { Logger } from '../logger';
export class StashSaveCommand extends Command {
constructor(private git: GitService) {
super(Commands.StashSave);
}
async execute(message?: string, unstagedOnly: boolean = false) {
if (!this.git.config.insiders) return undefined;
try {
if (message == null) {
message = await window.showInputBox({
prompt: `Please provide a stash message`,
placeHolder: `Stash message`
} as InputBoxOptions);
if (message === undefined) return undefined;
}
return await this.git.stashSave(this.git.repoPath, message, unstagedOnly);
}
catch (ex) {
Logger.error(ex, 'StashSaveCommand');
return window.showErrorMessage(`Unable to save stash. See output channel for more details`);
}
}
}