Adds Show Branch History command

Renames Show Repository History to Show Current Branch History
Doesn't migrate data yet
This commit is contained in:
Eric Amodio
2017-03-22 03:09:13 -04:00
parent 43e4337358
commit 9867e7065d
14 changed files with 98 additions and 47 deletions

View File

@@ -0,0 +1,29 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCachedCommand, Commands } from '../commands';
import { GitService } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem } from '../quickPicks';
export class ShowQuickCurrentBranchHistoryCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
super(Commands.ShowQuickCurrentBranchHistory);
}
async execute(editor: TextEditor, uri?: Uri, goBackCommand?: CommandQuickPickItem) {
if (!(uri instanceof Uri)) {
uri = editor && editor.document && editor.document.uri;
}
try {
const branch = (await this.git.getBranch(this.git.repoPath)).name;
return commands.executeCommand(Commands.ShowQuickBranchHistory, uri, branch, undefined, goBackCommand);
}
catch (ex) {
Logger.error('[GitLens.ShowQuickCurrentBranchHistoryCommand]', ex);
return window.showErrorMessage(`Unable to show branch history. See output channel for more details`);
}
}
}