Refactors commands to use typed args objects

This commit is contained in:
Eric Amodio
2017-05-14 01:48:07 -04:00
parent ee29596d45
commit 1acc183621
43 changed files with 2366 additions and 1761 deletions

View File

@@ -1,9 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { Commands, Keyboard, KeyNoopCommand, ShowCommitSearchCommandArgs, ShowQuickBranchHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
import { GitService, GitUri, IGitLog } from '../gitService';
import { GitService, GitUri, IGitLog, RemoteResource } from '../gitService';
import { OpenRemotesCommandQuickPickItem } from './remotes';
export class BranchHistoryQuickPick {
@@ -23,17 +23,33 @@ export class BranchHistoryQuickPick {
const currentCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${branch} history`
}, Commands.ShowQuickBranchHistory, [uri, branch, log.maxCount, goBackCommand, log]);
}, Commands.ShowQuickBranchHistory, [
uri,
{
branch,
log,
maxCount: log.maxCount,
goBackCommand
} as ShowQuickBranchHistoryCommandArgs
]);
const remotes = Arrays.uniqueBy(await git.getRemotes((uri && uri.repoPath) || git.repoPath), _ => _.url, _ => !!_.provider);
if (remotes.length) {
items.splice(0, 0, new OpenRemotesCommandQuickPickItem(remotes, 'branch', branch, currentCommand));
items.splice(0, 0, new OpenRemotesCommandQuickPickItem(remotes, {
type: 'branch',
branch
} as RemoteResource, currentCommand));
}
items.splice(0, 0, new CommandQuickPickItem({
label: `$(search) Show Commit Search`,
description: `\u00a0 \u2014 \u00a0\u00a0 search for commits by message, author, files, or commit id`
}, Commands.ShowCommitSearch, [new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }), undefined, undefined, currentCommand]));
}, Commands.ShowCommitSearch, [
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
{
goBackCommand: currentCommand
} as ShowCommitSearchCommandArgs
]));
let previousPageCommand: CommandQuickPickItem | undefined = undefined;
@@ -44,9 +60,11 @@ export class BranchHistoryQuickPick {
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
branch,
0,
goBackCommand
{
branch,
maxCount: 0,
goBackCommand
} as ShowQuickBranchHistoryCommandArgs
]));
}
else {
@@ -55,9 +73,10 @@ export class BranchHistoryQuickPick {
description: `\u00a0 \u2014 \u00a0\u00a0 shows \u00a0$(git-branch) ${branch} history`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
branch,
undefined,
currentCommand
{
branch,
goBackCommand: currentCommand
} as ShowQuickBranchHistoryCommandArgs
]));
}
@@ -69,14 +88,29 @@ export class BranchHistoryQuickPick {
const npc = new CommandQuickPickItem({
label: `$(arrow-right) Show Next Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
}, Commands.ShowQuickBranchHistory, [uri, branch, log.maxCount, goBackCommand, undefined, nextPageCommand]);
}, Commands.ShowQuickBranchHistory, [
uri,
{
branch,
maxCount: log.maxCount,
nextPageCommand
} as ShowQuickBranchHistoryCommandArgs
]);
const last = Iterables.last(log.commits.values());
if (last != null) {
previousPageCommand = new CommandQuickPickItem({
label: `$(arrow-left) Show Previous Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
}, Commands.ShowQuickBranchHistory, [new GitUri(uri ? uri : last.uri, last), branch, log.maxCount, goBackCommand, undefined, npc]);
}, Commands.ShowQuickBranchHistory, [
new GitUri(uri ? uri : last.uri, last),
{
branch,
maxCount: log.maxCount,
goBackCommand,
nextPageCommand: npc
} as ShowQuickBranchHistoryCommandArgs
]);
items.splice(0, 0, previousPageCommand);
}

View File

@@ -1,9 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, Keyboard, KeyNoopCommand, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem } from './common';
import { getGitStatusIcon, GitCommit, GitLogCommit, GitService, GitStashCommit, GitStatusFileStatus, GitUri, IGitLog, IGitStatusFile } from '../gitService';
import { getGitStatusIcon, GitCommit, GitLogCommit, GitService, GitStashCommit, GitStatusFileStatus, GitUri, IGitLog, IGitStatusFile, RemoteResource } from '../gitService';
import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as moment from 'moment';
import * as path from 'path';
@@ -93,47 +93,93 @@ 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, currentCommand]));
}, Commands.StashApply, [
{
confirm: true,
deleteAfter: false,
stashItem: commit as GitStashCommit,
goBackCommand: currentCommand
} as StashApplyCommandArgs
]));
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(x) Delete Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
}, Commands.StashDelete, [commit as GitStashCommit, true, currentCommand]));
}, Commands.StashDelete, [
{
confirm: true,
stashItem: commit as GitStashCommit,
goBackCommand: currentCommand
} as StashDeleteCommandArgs
]));
}
if (!stash) {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(clippy) Copy Commit ID to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [uri, commit.sha]));
}, Commands.CopyShaToClipboard, [
uri,
{
sha: commit.sha
} as CopyShaToClipboardCommandArgs
]));
}
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(clippy) Copy Message to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
}, Commands.CopyMessageToClipboard, [uri, commit.sha, commit.message]));
}, Commands.CopyMessageToClipboard, [
uri,
{
message: commit.message,
sha: commit.sha
} as CopyMessageToClipboardCommandArgs
]));
if (!stash) {
const remotes = Arrays.uniqueBy(await git.getRemotes(commit.repoPath), _ => _.url, _ => !!_.provider);
if (remotes.length) {
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, 'commit', commit.sha, currentCommand));
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
type: 'commit',
sha: commit.sha
} as RemoteResource, currentCommand));
}
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Directory Compare with Previous Commit`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousShortSha || `${commit.shortSha}^`} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.shortSha}`
}, Commands.DiffDirectory, [commit.uri, commit.previousSha || `${commit.sha}^`, commit.sha]));
}, Commands.DiffDirectory, [
commit.uri,
{
shaOrBranch1: commit.previousSha || `${commit.sha}^`,
shaOrBranch2: commit.sha
} as DiffDirectoryCommandCommandArgs
]));
}
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Directory Compare with Working Tree`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha} \u00a0 $(git-compare) \u00a0 $(file-directory) Working Tree`
}, Commands.DiffDirectory, [uri, commit.sha]));
}, Commands.DiffDirectory, [
uri,
{
shaOrBranch1: commit.sha
} as DiffDirectoryCommandCommandArgs
]));
items.splice(index++, 0, new CommandQuickPickItem({
label: `Changed Files`,
description: commit.getDiffStatus()
}, Commands.ShowQuickCommitDetails, [uri, commit.sha, commit, goBackCommand, repoLog]));
}, Commands.ShowQuickCommitDetails, [
uri,
{
commit,
repoLog,
sha: commit.sha,
goBackCommand
} as ShowQuickCommitDetailsCommandArgs
]));
items.push(new OpenCommitFilesCommandQuickPickItem(commit));
items.push(new OpenCommitWorkingTreeFilesCommandQuickPickItem(commit));
@@ -146,9 +192,28 @@ export class CommitDetailsQuickPick {
let nextCommand: CommandQuickPickItem | (() => Promise<CommandQuickPickItem>) | undefined = undefined;
if (!stash) {
// If we have the full history, we are good
if (repoLog && !repoLog.truncated && !repoLog.sha) {
previousCommand = commit.previousSha === undefined ? undefined : new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [commit.previousUri, commit.previousSha, undefined, goBackCommand, repoLog]);
nextCommand = commit.nextSha === undefined ? undefined : new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [commit.nextUri, commit.nextSha, undefined, goBackCommand, repoLog]);
if (repoLog !== undefined && !repoLog.truncated && repoLog.sha === undefined) {
previousCommand = commit.previousSha === undefined
? undefined
: new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [
commit.previousUri,
{
repoLog,
sha: commit.previousSha,
goBackCommand
} as ShowQuickCommitDetailsCommandArgs
]);
nextCommand = commit.nextSha === undefined
? undefined
: new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [
commit.nextUri,
{
repoLog,
sha: commit.nextSha,
goBackCommand
} as ShowQuickCommitDetailsCommandArgs
]);
}
else {
previousCommand = async () => {
@@ -156,7 +221,7 @@ export class CommitDetailsQuickPick {
let c = log && log.commits.get(commit.sha);
// If we can't find the commit or the previous commit isn't available (since it isn't trustworthy)
if (!c || !c.previousSha) {
if (c === undefined || c.previousSha === undefined) {
log = await git.getLogForRepo(commit.repoPath, commit.sha, git.config.advanced.maxQuickHistory);
c = log && log.commits.get(commit.sha);
@@ -165,8 +230,17 @@ export class CommitDetailsQuickPick {
c.nextSha = commit.nextSha;
}
}
if (!c || !c.previousSha) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [c.previousUri, c.previousSha, undefined, goBackCommand, log]);
if (c === undefined || c.previousSha === undefined) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [
c.previousUri,
{
repoLog: log,
sha: c.previousSha,
goBackCommand
} as ShowQuickCommitDetailsCommandArgs
]);
};
nextCommand = async () => {
@@ -174,20 +248,29 @@ export class CommitDetailsQuickPick {
let c = log && log.commits.get(commit.sha);
// If we can't find the commit or the next commit isn't available (since it isn't trustworthy)
if (!c || !c.nextSha) {
if (c === undefined || c.nextSha === undefined) {
log = undefined;
c = undefined;
// Try to find the next commit
const nextLog = await git.getLogForRepo(commit.repoPath, commit.sha, 1, true);
const next = nextLog && Iterables.first(nextLog.commits.values());
if (next && next.sha !== commit.sha) {
if (next !== undefined && next.sha !== commit.sha) {
c = commit;
c.nextSha = next.sha;
}
}
if (!c || !c.nextSha) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [c.nextUri, c.nextSha, undefined, goBackCommand, log]);
if (c === undefined || c.nextSha === undefined) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [
c.nextUri,
{
repoLog: log,
sha: c.nextSha,
goBackCommand
} as ShowQuickCommitDetailsCommandArgs
]);
};
}
}

View File

@@ -1,9 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, Keyboard, KeyNoopCommand, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
import { GitBranch, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
import { GitBranch, GitLogCommit, GitService, GitUri, IGitLog, RemoteResource } from '../gitService';
import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as moment from 'moment';
import * as path from 'path';
@@ -61,13 +61,25 @@ export class CommitFileDetailsQuickPick {
items.push(new CommandQuickPickItem({
label: `$(git-commit) Show Commit Details`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickCommitDetails, [new GitUri(commit.uri, commit), commit.sha, commit, currentCommand]));
}, Commands.ShowQuickCommitDetails, [
new GitUri(commit.uri, commit),
{
commit,
sha: commit.sha,
goBackCommand: currentCommand
} as ShowQuickCommitDetailsCommandArgs
]));
if (commit.previousSha) {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare with Previous Commit`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousShortSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.shortSha}`
}, Commands.DiffWithPrevious, [commit.uri, commit]));
}, Commands.DiffWithPrevious, [
commit.uri,
{
commit
} as DiffWithPreviousCommandArgs
]));
}
}
@@ -75,19 +87,35 @@ export class CommitFileDetailsQuickPick {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare with Working Tree`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha} \u00a0 $(git-compare) \u00a0 $(file-text) ${workingName}`
}, Commands.DiffWithWorking, [Uri.file(path.resolve(commit.repoPath, commit.workingFileName)), commit]));
}, Commands.DiffWithWorking, [
Uri.file(path.resolve(commit.repoPath, commit.workingFileName)),
{
commit
} as DiffWithWorkingCommandArgs
]));
}
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Commit ID to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [uri, commit.sha]));
}, Commands.CopyShaToClipboard, [
uri,
{
sha: commit.sha
} as CopyShaToClipboardCommandArgs
]));
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Message to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
}, Commands.CopyMessageToClipboard, [uri, commit.sha, commit.message]));
}, Commands.CopyMessageToClipboard, [
uri,
{
message: commit.message,
sha: commit.sha
} as CopyMessageToClipboardCommandArgs
]));
}
items.push(new OpenCommitFileCommandQuickPickItem(commit));
@@ -98,11 +126,19 @@ export class CommitFileDetailsQuickPick {
const remotes = Arrays.uniqueBy(await git.getRemotes(commit.repoPath), _ => _.url, _ => !!_.provider);
if (remotes.length) {
if (!stash) {
items.push(new OpenRemotesCommandQuickPickItem(remotes, 'file', commit.fileName, undefined, commit, currentCommand));
items.push(new OpenRemotesCommandQuickPickItem(remotes, {
type: 'file',
fileName: commit.fileName,
commit
} as RemoteResource, currentCommand));
}
if (commit.workingFileName && commit.status !== 'D') {
const branch = await git.getBranch(commit.repoPath || git.repoPath) as GitBranch;
items.push(new OpenRemotesCommandQuickPickItem(remotes, 'working-file', commit.workingFileName, branch.name, undefined, currentCommand));
items.push(new OpenRemotesCommandQuickPickItem(remotes, {
type: 'working-file',
fileName: commit.workingFileName,
branch: branch.name
} as RemoteResource, currentCommand));
}
}
@@ -110,14 +146,25 @@ export class CommitFileDetailsQuickPick {
items.push(new CommandQuickPickItem({
label: `$(history) Show File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(commit.fileName)}`
}, Commands.ShowQuickFileHistory, [Uri.file(path.resolve(commit.repoPath, commit.workingFileName)), undefined, undefined, currentCommand, fileLog]));
}, Commands.ShowQuickFileHistory, [
Uri.file(path.resolve(commit.repoPath, commit.workingFileName)),
{
fileLog,
goBackCommand: currentCommand
} as ShowQuickFileHistoryCommandArgs
]));
}
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(history) Show ${commit.workingFileName ? 'Previous ' : ''}File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(commit.fileName)} \u00a0\u2022\u00a0 from \u00a0$(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickFileHistory, [new GitUri(commit.uri, commit), undefined, undefined, currentCommand]));
}, Commands.ShowQuickFileHistory, [
new GitUri(commit.uri, commit),
{
goBackCommand: currentCommand
} as ShowQuickFileHistoryCommandArgs
]));
}
if (goBackCommand) {
@@ -128,9 +175,28 @@ export class CommitFileDetailsQuickPick {
let nextCommand: CommandQuickPickItem | (() => Promise<CommandQuickPickItem>) | undefined = undefined;
if (!stash) {
// If we have the full history, we are good
if (fileLog && !fileLog.truncated && !fileLog.sha) {
previousCommand = commit.previousSha === undefined ? undefined : new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [commit.previousUri, commit.previousSha, undefined, goBackCommand, fileLog]);
nextCommand = commit.nextSha === undefined ? undefined : new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [commit.nextUri, commit.nextSha, undefined, goBackCommand, fileLog]);
if (fileLog !== undefined && !fileLog.truncated && fileLog.sha === undefined) {
previousCommand = commit.previousSha === undefined
? undefined
: new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [
commit.previousUri,
{
fileLog,
sha: commit.previousSha,
goBackCommand
} as ShowQuickCommitFileDetailsCommandArgs
]);
nextCommand = commit.nextSha === undefined
? undefined
: new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [
commit.nextUri,
{
fileLog,
sha: commit.nextSha,
goBackCommand
} as ShowQuickCommitFileDetailsCommandArgs
]);
}
else {
previousCommand = async () => {
@@ -138,13 +204,13 @@ export class CommitFileDetailsQuickPick {
let c = log && log.commits.get(commit.sha);
// If we can't find the commit or the previous commit isn't available (since it isn't trustworthy)
if (!c || !c.previousSha) {
if (c === undefined || c.previousSha === undefined) {
log = await git.getLogForFile(commit.repoPath, uri.fsPath, commit.sha, git.config.advanced.maxQuickHistory);
if (log === undefined) return KeyNoopCommand;
c = log && log.commits.get(commit.sha);
// Since we exclude merge commits in file log, just grab the first returned commit
if (!c && commit.isMerge) {
if (c === undefined && commit.isMerge) {
c = Iterables.first(log.commits.values());
}
@@ -154,8 +220,17 @@ export class CommitFileDetailsQuickPick {
c.nextFileName = commit.nextFileName;
}
}
if (!c || !c.previousSha) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [c.previousUri, c.previousSha, undefined, goBackCommand, log]);
if (c === undefined || c.previousSha === undefined) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [
c.previousUri,
{
fileLog: log,
sha: c.previousSha,
goBackCommand
} as ShowQuickCommitFileDetailsCommandArgs
]);
};
nextCommand = async () => {
@@ -163,20 +238,29 @@ export class CommitFileDetailsQuickPick {
let c = log && log.commits.get(commit.sha);
// If we can't find the commit or the next commit isn't available (since it isn't trustworthy)
if (!c || !c.nextSha) {
if (c === undefined || c.nextSha === undefined) {
log = undefined;
c = undefined;
// Try to find the next commit
const next = await git.findNextCommit(commit.repoPath, uri.fsPath, commit.sha);
if (next && next.sha !== commit.sha) {
if (next !== undefined && next.sha !== commit.sha) {
c = commit;
c.nextSha = next.sha;
c.nextFileName = next.originalFileName || next.fileName;
}
}
if (!c || !c.nextSha) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [c.nextUri, c.nextSha, undefined, goBackCommand, log]);
if (c === undefined || c.nextSha === undefined) return KeyNoopCommand;
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [
c.nextUri,
{
fileLog: log,
sha: c.nextSha,
goBackCommand
} as ShowQuickCommitFileDetailsCommandArgs
]);
};
}
}

View File

@@ -1,6 +1,6 @@
'use strict';
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, Uri, window, workspace } from 'vscode';
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, TextEditor, Uri, window, workspace } from 'vscode';
import { Commands, Keyboard, Keys, KeyboardScope, KeyMapping, openEditor } from '../commands';
import { IAdvancedConfig } from '../configuration';
import { ExtensionKey } from '../constants';
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
@@ -61,20 +61,45 @@ function _getInfiniteCancellablePromise(cancellation: CancellationTokenSource) {
});
}
export interface QuickPickItem extends QuickPickItem {
onDidSelect?(): void;
onDidPressKey?(key: Keys): Promise<{} | undefined>;
}
export class CommandQuickPickItem implements QuickPickItem {
label: string;
description: string;
detail?: string | undefined;
protected command: Commands | undefined;
protected args: any[] | undefined;
constructor(item: QuickPickItem, protected command: Commands | undefined, protected args?: any[]) {
constructor(item: QuickPickItem, args?: [Commands, any[]]);
constructor(item: QuickPickItem, command?: Commands, args?: any[]);
constructor(item: QuickPickItem, commandOrArgs?: Commands | [Commands, any[]], args?: any[]) {
if (commandOrArgs === undefined) {
this.command = undefined;
this.args = args;
}
else if (typeof commandOrArgs === 'string') {
this.command = commandOrArgs;
this.args = args;
}
else {
this.command = commandOrArgs[0];
this.args = commandOrArgs.slice(1);
}
Object.assign(this, item);
}
execute(): Thenable<{} | undefined> {
execute(): Promise<{} | undefined> {
if (this.command === undefined) return Promise.resolve(undefined);
return commands.executeCommand(this.command, ...(this.args || []));
return commands.executeCommand(this.command, ...(this.args || [])) as Promise<{} | undefined>;
}
onDidPressKey(key: Keys): Promise<{} | undefined> {
return this.execute();
}
}
@@ -91,12 +116,22 @@ export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
super(item, undefined, undefined);
}
async execute(pinned: boolean = false): Promise<{} | undefined> {
return this.open(pinned);
async execute(options?: TextDocumentShowOptions): Promise<TextEditor | undefined> {
return openEditor(this.uri, options);
}
async open(pinned: boolean = false): Promise<{} | undefined> {
return openEditor(this.uri, pinned);
onDidSelect(): Promise<{} | undefined> {
return this.execute({
preserveFocus: true,
preview: true
});
}
onDidPressKey(key: Keys): Promise<{} | undefined> {
return this.execute({
preserveFocus: true,
preview: false
});
}
}
@@ -106,12 +141,19 @@ export class OpenFilesCommandQuickPickItem extends CommandQuickPickItem {
super(item, undefined, undefined);
}
async execute(): Promise<{} | undefined> {
async execute(options: TextDocumentShowOptions = { preserveFocus: false, preview: false }): Promise<{} | undefined> {
for (const uri of this.uris) {
await openEditor(uri, true);
await openEditor(uri, options);
}
return undefined;
}
async onDidPressKey(key: Keys): Promise<{} | undefined> {
return this.execute({
preserveFocus: true,
preview: false
});
}
}
export class CommitQuickPickItem implements QuickPickItem {

View File

@@ -1,9 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { Commands, Keyboard, KeyNoopCommand, ShowQuickCurrentBranchHistoryCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
import { GitService, GitUri, IGitLog } from '../gitService';
import { GitService, GitUri, IGitLog, RemoteResource } from '../gitService';
import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as path from 'path';
@@ -30,7 +30,13 @@ export class FileHistoryQuickPick {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(sync) Show All Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
}, Commands.ShowQuickFileHistory, [Uri.file(uri.fsPath), undefined, 0, goBackCommand]));
}, Commands.ShowQuickFileHistory, [
Uri.file(uri.fsPath),
{
maxCount: 0,
goBackCommand
} as ShowQuickFileHistoryCommandArgs
]));
}
else {
const workingFileName = await git.findWorkingFileName(log.repoPath, path.relative(log.repoPath, uri.fsPath));
@@ -40,14 +46,22 @@ export class FileHistoryQuickPick {
label: `$(history) Show File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(workingFileName)}`
}, Commands.ShowQuickFileHistory, [
Uri.file(path.resolve(log.repoPath, workingFileName)),
undefined,
undefined,
new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from \u00a0$(git-commit) ${uri.shortSha}` : ''}`
}, Commands.ShowQuickFileHistory, [uri, log.range, log.maxCount, goBackCommand, log])
]));
Uri.file(path.resolve(log.repoPath, workingFileName)),
{
goBackCommand: new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from \u00a0$(git-commit) ${uri.shortSha}` : ''}`
}, Commands.ShowQuickFileHistory, [
uri,
{
log: log,
maxCount: log.maxCount,
range: log.range,
goBackCommand
} as ShowQuickFileHistoryCommandArgs
])
} as ShowQuickFileHistoryCommandArgs
]));
}
}
@@ -60,14 +74,28 @@ export class FileHistoryQuickPick {
const npc = new CommandQuickPickItem({
label: `$(arrow-right) Show Next Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
}, Commands.ShowQuickFileHistory, [uri, undefined, log.maxCount, goBackCommand, undefined, nextPageCommand]);
}, Commands.ShowQuickFileHistory, [
uri,
{
maxCount: log.maxCount,
goBackCommand,
nextPageCommand
} as ShowQuickFileHistoryCommandArgs
]);
const last = Iterables.last(log.commits.values());
if (last != null) {
previousPageCommand = new CommandQuickPickItem({
label: `$(arrow-left) Show Previous Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
}, Commands.ShowQuickFileHistory, [new GitUri(uri, last), undefined, log.maxCount, goBackCommand, undefined, npc]);
}, Commands.ShowQuickFileHistory, [
new GitUri(uri, last),
{
maxCount: log.maxCount,
goBackCommand,
nextPageCommand: npc
} as ShowQuickFileHistoryCommandArgs
]);
index++;
items.splice(0, 0, previousPageCommand);
@@ -80,23 +108,37 @@ export class FileHistoryQuickPick {
const currentCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from \u00a0$(git-commit) ${uri.shortSha}` : ''}`
}, Commands.ShowQuickFileHistory, [uri, log.range, log.maxCount, undefined, log]);
}, Commands.ShowQuickFileHistory, [
uri,
{
log,
maxCount: log.maxCount,
range: log.range
} as ShowQuickFileHistoryCommandArgs
]);
// Only show the full repo option if we are the root
if (!goBackCommand) {
if (goBackCommand === undefined) {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(history) Show Branch History`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows \u00a0$(git-branch) ${branch!.name} history`
}, Commands.ShowQuickCurrentBranchHistory,
[
undefined,
currentCommand
{
goBackCommand: currentCommand
} as ShowQuickCurrentBranchHistoryCommandArgs
]));
}
const remotes = Arrays.uniqueBy(await git.getRemotes(uri.repoPath!), _ => _.url, _ => !!_.provider);
if (remotes.length) {
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, 'file', uri.getRelativePath(), branch!.name, uri.sha, currentCommand));
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
type: 'file',
branch: branch!.name,
fileName: uri.getRelativePath(),
sha: uri.sha
} as RemoteResource, currentCommand));
}
if (goBackCommand) {

View File

@@ -1,88 +1,66 @@
'use strict';
import { QuickPickOptions, window } from 'vscode';
import { Commands } from '../commands';
import { Commands, OpenInRemoteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './common';
import { getNameFromRemoteOpenType, GitLogCommit, GitRemote, RemoteOpenType } from '../gitService';
import { getNameFromRemoteResource, GitLogCommit, GitRemote, RemoteResource } from '../gitService';
import * as path from 'path';
export class OpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
private remote: GitRemote;
private type: RemoteOpenType;
private resource: RemoteResource;
constructor(remote: GitRemote, type: RemoteOpenType, ...args: string[]) {
constructor(remote: GitRemote, resource: RemoteResource) {
super({
label: `$(link-external) Open ${getNameFromRemoteOpenType(type)} in ${remote.provider!.name}`,
label: `$(link-external) Open ${getNameFromRemoteResource(resource)} in ${remote.provider!.name}`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(repo) ${remote.provider!.path}`
}, undefined, undefined);
this.remote = remote;
this.type = type;
this.args = args;
this.resource = resource;
}
async execute(): Promise<{}> {
return this.remote.provider!.open(this.type, ...this.args!);
return this.remote.provider!.open(this.resource);
}
}
export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
constructor(remotes: GitRemote[], type: 'branch', branch: string, goBackCommand?: CommandQuickPickItem);
constructor(remotes: GitRemote[], type: 'commit', sha: string, goBackCommand?: CommandQuickPickItem);
constructor(remotes: GitRemote[], type: 'file', fileName: string, branch?: string, commit?: GitLogCommit, goBackCommand?: CommandQuickPickItem);
constructor(remotes: GitRemote[], type: 'file' | 'working-file', fileName: string, branch?: string, sha?: string, goBackCommand?: CommandQuickPickItem);
constructor(remotes: GitRemote[], type: RemoteOpenType, branchOrShaOrFileName: string, goBackCommandOrFileBranch?: CommandQuickPickItem | string, fileShaOrCommit?: string | GitLogCommit, goBackCommand?: CommandQuickPickItem) {
let fileBranch: string | undefined = undefined;
if (typeof goBackCommandOrFileBranch === 'string') {
fileBranch = goBackCommandOrFileBranch;
}
else if (!goBackCommand) {
goBackCommand = goBackCommandOrFileBranch;
}
constructor(remotes: GitRemote[], resource: RemoteResource, goBackCommand?: CommandQuickPickItem) {
const name = getNameFromRemoteResource(resource);
const name = getNameFromRemoteOpenType(type);
let fileSha: string | undefined = undefined;
let description: string | undefined = undefined;
let placeHolder: string | undefined = undefined;
switch (type) {
let description: string = '';
switch (resource.type) {
case 'branch':
description = `$(git-branch) ${branchOrShaOrFileName}`;
placeHolder = `open ${branchOrShaOrFileName} ${name.toLowerCase()} in\u2026`;
description = `$(git-branch) ${resource.branch}`;
break;
case 'commit':
const shortSha = branchOrShaOrFileName.substring(0, 8);
const shortSha = resource.sha.substring(0, 8);
description = `$(git-commit) ${shortSha}`;
placeHolder = `open ${name.toLowerCase()} ${shortSha} in\u2026`;
break;
case 'file':
case 'working-file':
const fileName = path.basename(branchOrShaOrFileName);
if (fileShaOrCommit instanceof GitLogCommit) {
if (fileShaOrCommit.status === 'D') {
fileSha = fileShaOrCommit.previousSha;
description = `$(file-text) ${fileName} in \u00a0$(git-commit) ${fileShaOrCommit.previousShortSha} (deleted in \u00a0$(git-commit) ${fileShaOrCommit.shortSha})`;
placeHolder = `open ${branchOrShaOrFileName} \u00a0\u2022\u00a0 ${fileShaOrCommit.previousShortSha} in\u2026`;
case 'file':
if (resource.commit !== undefined && resource.commit instanceof GitLogCommit) {
if (resource.commit.status === 'D') {
resource.sha = resource.commit.previousSha;
description = `$(file-text) ${path.basename(resource.fileName)} in \u00a0$(git-commit) ${resource.commit.previousShortSha} (deleted in \u00a0$(git-commit) ${resource.commit.shortSha})`;
}
else {
fileSha = fileShaOrCommit.sha;
description = `$(file-text) ${fileName} in \u00a0$(git-commit) ${fileShaOrCommit.shortSha}`;
placeHolder = `open ${branchOrShaOrFileName} \u00a0\u2022\u00a0 ${fileShaOrCommit.shortSha} in\u2026`;
resource.sha = resource.commit.sha;
description = `$(file-text) ${path.basename(resource.fileName)} in \u00a0$(git-commit) ${resource.commit.shortSha}`;
}
}
else {
fileSha = fileShaOrCommit;
const shortFileSha = (fileSha && fileSha.substring(0, 8)) || '';
const shaSuffix = shortFileSha ? ` \u00a0\u2022\u00a0 ${shortFileSha}` : '';
description = `$(file-text) ${fileName}${shortFileSha ? ` in \u00a0$(git-commit) ${shortFileSha}` : ''}`;
placeHolder = `open ${branchOrShaOrFileName}${shaSuffix} in\u2026`;
const shortFileSha = resource.sha === undefined ? '' : resource.sha.substring(0, 8);
description = `$(file-text) ${path.basename(resource.fileName)}${shortFileSha ? ` in \u00a0$(git-commit) ${shortFileSha}` : ''}`;
}
break;
case 'working-file':
description = `$(file-text) ${path.basename(resource.fileName)}`;
break;
}
const remote = remotes[0];
@@ -90,7 +68,14 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
super({
label: `$(link-external) Open ${name} in ${remote.provider!.name}`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(repo) ${remote.provider!.path} \u00a0\u2022\u00a0 ${description}`
}, Commands.OpenInRemote, [undefined, remotes, type, [branchOrShaOrFileName, fileBranch, fileSha], goBackCommand]);
}, Commands.OpenInRemote, [
undefined,
{
remotes,
resource,
goBackCommand
} as OpenInRemoteCommandArgs
]);
return;
}
@@ -102,15 +87,21 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
super({
label: `$(link-external) Open ${name} in ${provider}\u2026`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${description}`
}, Commands.OpenInRemote, [undefined, remotes, type, [branchOrShaOrFileName, fileBranch, fileSha], goBackCommand]);
}, Commands.OpenInRemote, [
undefined,
{
remotes,
resource,
goBackCommand
} as OpenInRemoteCommandArgs
]);
}
}
export class RemotesQuickPick {
static async show(remotes: GitRemote[], placeHolder: string, type: RemoteOpenType, args: string[], goBackCommand?: CommandQuickPickItem): Promise<OpenRemoteCommandQuickPickItem | CommandQuickPickItem | undefined> {
const items = remotes.map(_ => new OpenRemoteCommandQuickPickItem(_, type, ...args)) as (OpenRemoteCommandQuickPickItem | CommandQuickPickItem)[];
static async show(remotes: GitRemote[], placeHolder: string, resource: RemoteResource, goBackCommand?: CommandQuickPickItem): Promise<OpenRemoteCommandQuickPickItem | CommandQuickPickItem | undefined> {
const items = remotes.map(_ => new OpenRemoteCommandQuickPickItem(_, resource)) as (OpenRemoteCommandQuickPickItem | CommandQuickPickItem)[];
if (goBackCommand) {
items.splice(0, 0, goBackCommand);
@@ -118,12 +109,11 @@ export class RemotesQuickPick {
// const scope = await Keyboard.instance.beginScope({ left: goBackCommand });
const pick = await window.showQuickPick(items,
{
placeHolder: placeHolder,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
} as QuickPickOptions);
if (!pick) return undefined;
const pick = await window.showQuickPick(items, {
placeHolder: placeHolder,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
} as QuickPickOptions);
if (pick === undefined) return undefined;
// await scope.dispose();

View File

@@ -1,7 +1,7 @@
'use strict';
import { Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard } from '../commands';
import { Commands, Keyboard, OpenChangedFilesCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickRepoStatusCommandArgs, ShowQuickStashListCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem } from './common';
import { GitService, GitStatusFile, GitUri, IGitStatus } from '../gitService';
import * as path from 'path';
@@ -36,7 +36,12 @@ export class OpenStatusFilesCommandQuickPickItem extends CommandQuickPickItem {
label: `$(file-symlink-file) Open Changed Files`,
description: ''
//detail: `Opens all of the changed files in the repository`
}, Commands.OpenChangedFiles, [undefined, uris]);
}, Commands.OpenChangedFiles, [
undefined,
{
uris
} as OpenChangedFilesCommandArgs
]);
}
}
@@ -72,7 +77,12 @@ export class RepoStatusQuickPick {
const currentCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${status.branch} status`
}, Commands.ShowQuickRepoStatus, [undefined, goBackCommand]);
}, Commands.ShowQuickRepoStatus, [
undefined,
{
goBackCommand
} as ShowQuickRepoStatusCommandArgs
]);
if (hasStaged) {
let index = 0;
@@ -81,7 +91,12 @@ export class RepoStatusQuickPick {
items.splice(unstagedIndex, 0, new CommandQuickPickItem({
label: `Unstaged Files`,
description: unstagedStatus
}, Commands.ShowQuickRepoStatus, [undefined, goBackCommand]));
}, Commands.ShowQuickRepoStatus, [
undefined,
{
goBackCommand
} as ShowQuickRepoStatusCommandArgs
]));
items.splice(unstagedIndex, 0, new OpenStatusFilesCommandQuickPickItem(files.filter(_ => _.status !== 'D' && _.staged), {
label: `\u00a0\u00a0\u00a0\u00a0 $(file-symlink-file) Open Staged Files`,
@@ -97,13 +112,23 @@ export class RepoStatusQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `Staged Files`,
description: stagedStatus
}, Commands.ShowQuickRepoStatus, [undefined, goBackCommand]));
}, Commands.ShowQuickRepoStatus, [
undefined,
{
goBackCommand
} as ShowQuickRepoStatusCommandArgs
]));
}
else if (files.some(_ => !_.staged)) {
items.splice(0, 0, new CommandQuickPickItem({
label: `Unstaged Files`,
description: unstagedStatus
}, Commands.ShowQuickRepoStatus, [undefined, goBackCommand]));
}, Commands.ShowQuickRepoStatus, [
undefined,
{
goBackCommand
} as ShowQuickRepoStatusCommandArgs
]));
}
if (files.length) {
@@ -117,13 +142,23 @@ export class RepoStatusQuickPick {
items.push(new CommandQuickPickItem({
label: `No changes in the working tree`,
description: ''
}, Commands.ShowQuickRepoStatus, [undefined, goBackCommand]));
}, Commands.ShowQuickRepoStatus, [
undefined,
{
goBackCommand
} as ShowQuickRepoStatusCommandArgs
]));
}
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-push) Show Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows stashed changes in the repository`
}, Commands.ShowQuickStashList, [new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath }), currentCommand]));
}, Commands.ShowQuickStashList, [
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath }),
{
goBackCommand: currentCommand
} as ShowQuickStashListCommandArgs
]));
if (status.upstream && status.state.ahead) {
items.splice(0, 0, new CommandQuickPickItem({
@@ -131,9 +166,12 @@ export class RepoStatusQuickPick {
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.branch} but not \u00a0$(git-branch) ${status.upstream}`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.upstream}..${status.branch}` }),
status.branch, 0, currentCommand
])
);
{
branch: status.branch,
maxCount: 0,
goBackCommand: currentCommand
} as ShowQuickBranchHistoryCommandArgs
]));
}
if (status.upstream && status.state.behind) {
@@ -142,16 +180,24 @@ export class RepoStatusQuickPick {
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.upstream} but not \u00a0$(git-branch) ${status.branch}${status.sha ? ` (since \u00a0$(git-commit) ${status.sha.substring(0, 8)})` : ''}`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.branch}..${status.upstream}` }),
status.upstream, 0, currentCommand
])
);
{
branch: status.upstream,
maxCount: 0,
goBackCommand: currentCommand
} as ShowQuickBranchHistoryCommandArgs
]));
}
if (status.upstream && !status.state.ahead && !status.state.behind) {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(git-branch) ${status.branch} is up-to-date with \u00a0$(git-branch) ${status.upstream}`,
description: ''
}, Commands.ShowQuickRepoStatus, [undefined, goBackCommand]));
}, Commands.ShowQuickRepoStatus, [
undefined,
{
goBackCommand
} as ShowQuickRepoStatusCommandArgs
]));
}

View File

@@ -1,7 +1,7 @@
'use strict';
import { Iterables } from '../system';
import { QuickPickOptions, window } from 'vscode';
import { Commands, Keyboard } from '../commands';
import { Commands, Keyboard, StashSaveCommandArgs } from '../commands';
import { GitService, IGitStash } from '../gitService';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks';
@@ -14,12 +14,22 @@ export class StashListQuickPick {
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, currentCommand]));
}, Commands.StashSave, [
{
unstagedOnly: true,
goBackCommand: currentCommand
} as StashSaveCommandArgs
]));
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-push) Stash Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 stashes all changes`
}, Commands.StashSave, [undefined, undefined, currentCommand]));
}, Commands.StashSave, [
{
unstagedOnly: false,
goBackCommand: currentCommand
} as StashSaveCommandArgs
]));
}
if (goBackCommand) {