mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-11 18:48:38 -05:00
Refactors commit quick pick commands
Splits showQuickCommitDetails into showQuickCommitDetails and showQuickCommitFileDetails Adds closeUnchangedFiles command Adds openChangedFiles command Adds diffDirectory command Adds contextual description to the `go back` commands Fixes #44 by adding a warning message about Git version requirements Fixes intermittent errors when adding active line annotations Fixes intermittent errors when opening multiple files via quick picks Updates dependencies Preps v2.11.0
This commit is contained in:
35
src/commands/diffDirectory.ts
Normal file
35
src/commands/diffDirectory.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { GitProvider } from '../gitProvider';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
export class DiffDirectoryCommand extends ActiveEditorCommand {
|
||||
|
||||
constructor(private git: GitProvider, public repoPath: string) {
|
||||
super(Commands.DiffDirectory);
|
||||
}
|
||||
|
||||
async execute(editor: TextEditor, uri?: Uri, shaOrBranch1?: string, shaOrBranch2?: string): Promise<any> {
|
||||
if (!(uri instanceof Uri)) {
|
||||
uri = editor && editor.document && editor.document.uri;
|
||||
}
|
||||
|
||||
try {
|
||||
const repoPath = await this.git.getRepoPathFromUri(uri, this.repoPath);
|
||||
if (!repoPath) return window.showWarningMessage(`Unable to open directory diff`);
|
||||
|
||||
if (!shaOrBranch1) {
|
||||
//window.showQuickPick()
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.git.openDirectoryDiff(repoPath, shaOrBranch1, shaOrBranch2);
|
||||
return undefined;
|
||||
}
|
||||
catch (ex) {
|
||||
Logger.error('GitLens.DiffDirectoryCommand', ex);
|
||||
return window.showErrorMessage(`Unable to open directory diff. See output channel for more details`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user