From bfcce3b7521e1c02b1ff5b483fccd0d964b9ab67 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 15 Jun 2019 02:18:00 -0400 Subject: [PATCH] Changes commit search to prompt for repo --- src/commands/closeUnchangedFiles.ts | 1 - src/commands/common.ts | 6 +----- src/commands/externalDiff.ts | 5 +---- src/commands/openChangedFiles.ts | 1 - src/commands/searchCommits.ts | 10 +++------- src/commands/stashApply.ts | 1 - src/commands/stashSave.ts | 4 ++-- src/views/nodes/compareNode.ts | 2 +- 8 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/commands/closeUnchangedFiles.ts b/src/commands/closeUnchangedFiles.ts index 0a6a059..f8f25fe 100644 --- a/src/commands/closeUnchangedFiles.ts +++ b/src/commands/closeUnchangedFiles.ts @@ -28,7 +28,6 @@ export class CloseUnchangedFilesCommand extends ActiveEditorCommand { args = { ...args }; const repoPath = await getRepoPathOrPrompt( - undefined, `Close all files except those changed in which repository${GlyphChars.Ellipsis}` ); if (!repoPath) return undefined; diff --git a/src/commands/common.ts b/src/commands/common.ts index 1001ea1..b16295d 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -166,11 +166,7 @@ export async function getRepoPathOrActiveOrPrompt( return repoPath; } -export async function getRepoPathOrPrompt( - uri: Uri | undefined, - placeholder: string, - goBackCommand?: CommandQuickPickItem -) { +export async function getRepoPathOrPrompt(placeholder: string, goBackCommand?: CommandQuickPickItem, uri?: Uri) { let repoPath = await Container.git.getRepoPath(uri); if (!repoPath) { const pick = await RepositoriesQuickPick.show(placeholder, goBackCommand); diff --git a/src/commands/externalDiff.ts b/src/commands/externalDiff.ts index deb1cc9..5a3e8e0 100644 --- a/src/commands/externalDiff.ts +++ b/src/commands/externalDiff.ts @@ -124,10 +124,7 @@ export class ExternalDiffCommand extends Command { if (context.command === Commands.ExternalDiffAll) { if (args.files === undefined) { - const repoPath = await getRepoPathOrPrompt( - undefined, - `Open changes from which repository${GlyphChars.Ellipsis}` - ); + const repoPath = await getRepoPathOrPrompt(`Open changes from which repository${GlyphChars.Ellipsis}`); if (!repoPath) return undefined; const status = await Container.git.getStatusForRepo(repoPath); diff --git a/src/commands/openChangedFiles.ts b/src/commands/openChangedFiles.ts index 70defdd..d357577 100644 --- a/src/commands/openChangedFiles.ts +++ b/src/commands/openChangedFiles.ts @@ -25,7 +25,6 @@ export class OpenChangedFilesCommand extends ActiveEditorCommand { args = { ...args }; const repoPath = await getRepoPathOrPrompt( - undefined, `Open all files changed in which repository${GlyphChars.Ellipsis}` ); if (!repoPath) return undefined; diff --git a/src/commands/searchCommits.ts b/src/commands/searchCommits.ts index 072f4e1..4eebe91 100644 --- a/src/commands/searchCommits.ts +++ b/src/commands/searchCommits.ts @@ -2,7 +2,7 @@ import { commands, InputBoxOptions, TextEditor, Uri, window } from 'vscode'; import { GlyphChars } from '../constants'; import { Container } from '../container'; -import { GitRepoSearchBy, GitService, GitUri } from '../git/gitService'; +import { GitRepoSearchBy, GitService } from '../git/gitService'; import { Logger } from '../logger'; import { Messages } from '../messages'; import { CommandQuickPickItem, CommitsQuickPick, ShowCommitSearchResultsInViewQuickPickItem } from '../quickpicks'; @@ -14,7 +14,7 @@ import { CommandContext, Commands, getCommandUri, - getRepoPathOrActiveOrPrompt, + getRepoPathOrPrompt, isCommandViewContextWithRepo } from './common'; import { ShowQuickCommitDetailsCommandArgs } from './showQuickCommitDetails'; @@ -80,11 +80,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand { async execute(editor?: TextEditor, uri?: Uri, args: SearchCommitsCommandArgs = {}) { uri = getCommandUri(uri, editor); - const gitUri = uri && (await GitUri.fromUri(uri)); - - const repoPath = await getRepoPathOrActiveOrPrompt( - gitUri, - editor, + const repoPath = await getRepoPathOrPrompt( `Search for commits in which repository${GlyphChars.Ellipsis}`, args.goBackCommand ); diff --git a/src/commands/stashApply.ts b/src/commands/stashApply.ts index 2b8dd41..a959cb8 100644 --- a/src/commands/stashApply.ts +++ b/src/commands/stashApply.ts @@ -52,7 +52,6 @@ export class StashApplyCommand extends Command { if (args.stashItem === undefined || args.stashItem.stashName === undefined) { if (args.repoPath === undefined) { args.repoPath = await getRepoPathOrPrompt( - undefined, `Apply stashed changes from which repository${GlyphChars.Ellipsis}`, args.goBackCommand ); diff --git a/src/commands/stashSave.ts b/src/commands/stashSave.ts index 071b831..7a3a437 100644 --- a/src/commands/stashSave.ts +++ b/src/commands/stashSave.ts @@ -65,9 +65,9 @@ export class StashSaveCommand extends Command { const uri = args.uris !== undefined && args.uris.length !== 0 ? args.uris[0] : undefined; if (args.repoPath === undefined) { args.repoPath = await getRepoPathOrPrompt( - uri, `Stash changes for which repository${GlyphChars.Ellipsis}`, - args.goBackCommand + args.goBackCommand, + uri ); } if (!args.repoPath) return undefined; diff --git a/src/views/nodes/compareNode.ts b/src/views/nodes/compareNode.ts index fa8e652..1222e33 100644 --- a/src/views/nodes/compareNode.ts +++ b/src/views/nodes/compareNode.ts @@ -163,7 +163,7 @@ export class CompareNode extends ViewNode { async selectForCompare(repoPath?: string, ref?: string | NamedRef) { if (repoPath === undefined) { - repoPath = await getRepoPathOrPrompt(undefined, `Compare in which repository${GlyphChars.Ellipsis}`); + repoPath = await getRepoPathOrPrompt(`Compare in which repository${GlyphChars.Ellipsis}`); } if (repoPath === undefined) return;