mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-24 17:24:53 -05:00
Adds branch quick pick to directory compare command
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks';
|
||||
|
||||
export class DiffDirectoryCommand extends ActiveEditorCommand {
|
||||
|
||||
@@ -20,8 +22,18 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
|
||||
if (!repoPath) return window.showWarningMessage(`Unable to open directory diff`);
|
||||
|
||||
if (!shaOrBranch1) {
|
||||
//window.showQuickPick()
|
||||
return undefined;
|
||||
const branches = await this.git.getBranches(repoPath);
|
||||
const current = Iterables.find(branches, _ => _.current);
|
||||
|
||||
const pick = await BranchesQuickPick.show(branches, `Compare ${current.name} to \u2026`);
|
||||
if (!pick) return undefined;
|
||||
|
||||
if (pick instanceof CommandQuickPickItem) {
|
||||
return pick.execute();
|
||||
}
|
||||
|
||||
shaOrBranch1 = pick.branch.name;
|
||||
if (!shaOrBranch1) return undefined;
|
||||
}
|
||||
|
||||
this.git.openDirectoryDiff(repoPath, shaOrBranch1, shaOrBranch2);
|
||||
|
||||
@@ -24,7 +24,7 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
|
||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||
|
||||
const branches = await this.git.getBranches(gitUri.repoPath);
|
||||
const pick = await BranchesQuickPick.show(branches, gitUri, goBackCommand);
|
||||
const pick = await BranchesQuickPick.show(branches, `Compare ${path.basename(gitUri.fsPath)} to \u2026`, goBackCommand);
|
||||
if (!pick) return undefined;
|
||||
|
||||
if (pick instanceof CommandQuickPickItem) {
|
||||
|
||||
Reference in New Issue
Block a user