Adds branch quick pick to directory compare command

This commit is contained in:
Eric Amodio
2017-03-18 11:06:30 -04:00
parent 73bbbc1d5f
commit 343d2f9be1
3 changed files with 18 additions and 7 deletions

View File

@@ -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);

View File

@@ -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) {