diff --git a/CHANGELOG.md b/CHANGELOG.md index c87c2b6..adb9ba9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes an issue where the Visual File History wasn't correctly opening the commit file details quick pick menu - Fixes an issue where the _Open Visual File History of Active File_ command wasn't showing in the Command Palette ## [12.0.3] - 2022-03-10 diff --git a/src/commands/showQuickCommitFile.ts b/src/commands/showQuickCommitFile.ts index 638f6cf..cc9ec62 100644 --- a/src/commands/showQuickCommitFile.ts +++ b/src/commands/showQuickCommitFile.ts @@ -44,7 +44,7 @@ export class ShowQuickCommitFileCommand extends ActiveEditorCachedCommand { args.sha = context.node.uri.sha; if (isCommandContextViewNodeHasCommit(context)) { - args.commit = context.node.commit as any; + args.commit = context.node.commit; } } @@ -58,21 +58,21 @@ export class ShowQuickCommitFileCommand extends ActiveEditorCachedCommand { args = { ...args }; let gitUri; - if (args.revisionUri !== undefined) { + if (args.revisionUri != null) { gitUri = GitUri.fromRevisionUri(Uri.parse(args.revisionUri, true)); args.sha = gitUri.sha; } else { gitUri = await GitUri.fromUri(uri); } - if (args.sha === undefined) { + if (args.sha == null) { if (editor == null) return; - const blameline = editor.selection.active.line; - if (blameline < 0) return; + const blameLine = editor.selection.active.line; + if (blameLine < 0) return; try { - const blame = await this.container.git.getBlameForLine(gitUri, blameline); + const blame = await this.container.git.getBlameForLine(gitUri, blameLine); if (blame == null) { void Messages.showFileNotUnderSourceControlWarningMessage('Unable to show commit file details'); @@ -90,7 +90,7 @@ export class ShowQuickCommitFileCommand extends ActiveEditorCachedCommand { args.commit = blame.commit; } catch (ex) { - Logger.error(ex, 'ShowQuickCommitFileDetailsCommand', `getBlameForLine(${blameline})`); + Logger.error(ex, 'ShowQuickCommitFileDetailsCommand', `getBlameForLine(${blameLine})`); void window.showErrorMessage('Unable to show commit file details. See output channel for more details'); return; diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 319b14e..74014d2 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -901,10 +901,10 @@ export class GitProviderService implements Disposable { } getRevisionUri(uri: GitUri): Uri; - getRevisionUri(ref: string, path: string, repoPath: string): Uri; - getRevisionUri(ref: string, file: GitFile, repoPath: string): Uri; + getRevisionUri(ref: string, path: string, repoPath: string | Uri): Uri; + getRevisionUri(ref: string, file: GitFile, repoPath: string | Uri): Uri; @log() - getRevisionUri(refOrUri: string | GitUri, pathOrFile?: string | GitFile, repoPath?: string): Uri { + getRevisionUri(refOrUri: string | GitUri, pathOrFile?: string | GitFile, repoPath?: string | Uri): Uri { let path: string; let ref: string | undefined; diff --git a/src/plus/webviews/timeline/timelineWebview.ts b/src/plus/webviews/timeline/timelineWebview.ts index eb4385f..492f383 100644 --- a/src/plus/webviews/timeline/timelineWebview.ts +++ b/src/plus/webviews/timeline/timelineWebview.ts @@ -1,6 +1,6 @@ 'use strict'; import { commands, Disposable, TextEditor, Uri, ViewColumn, window } from 'vscode'; -import type { ShowQuickCommitCommandArgs } from '../../../commands'; +import type { ShowQuickCommitFileCommandArgs } from '../../../commands'; import { configuration } from '../../../configuration'; import { Commands, ContextKeys } from '../../../constants'; import type { Container } from '../../../container'; @@ -12,6 +12,7 @@ import { createFromDateDelta } from '../../../system/date'; import { debug } from '../../../system/decorators/log'; import { debounce, Deferrable } from '../../../system/function'; import { filter } from '../../../system/iterable'; +import { getBestPath } from '../../../system/path'; import { hasVisibleTextEditor, isTextEditor } from '../../../system/utils'; import { IpcMessage, onIpc } from '../../../webviews/protocol'; import { WebviewBase } from '../../../webviews/webviewBase'; @@ -146,12 +147,13 @@ export class TimelineWebview extends WebviewBase { const repository = this.container.git.getRepository(this._context.uri); if (repository == null) return; - const commandArgs: ShowQuickCommitCommandArgs = { - repoPath: repository.path, - sha: params.data.id, + const commandArgs: ShowQuickCommitFileCommandArgs = { + revisionUri: this.container.git + .getRevisionUri(params.data.id, getBestPath(this._context.uri), repository.uri) + .toString(true), }; - void commands.executeCommand(Commands.ShowQuickCommit, commandArgs); + void commands.executeCommand(Commands.ShowQuickCommitFile, commandArgs); // const commandArgs: DiffWithPreviousCommandArgs = { // line: 0, diff --git a/src/plus/webviews/timeline/timelineWebviewView.ts b/src/plus/webviews/timeline/timelineWebviewView.ts index cc6f323..ee40613 100644 --- a/src/plus/webviews/timeline/timelineWebviewView.ts +++ b/src/plus/webviews/timeline/timelineWebviewView.ts @@ -1,6 +1,6 @@ 'use strict'; import { commands, Disposable, TextEditor, Uri, window } from 'vscode'; -import type { ShowQuickCommitCommandArgs } from '../../../commands'; +import type { ShowQuickCommitFileCommandArgs } from '../../../commands'; import { configuration } from '../../../configuration'; import { Commands } from '../../../constants'; import { Container } from '../../../container'; @@ -12,6 +12,7 @@ import { createFromDateDelta } from '../../../system/date'; import { debug } from '../../../system/decorators/log'; import { debounce, Deferrable } from '../../../system/function'; import { filter } from '../../../system/iterable'; +import { getBestPath } from '../../../system/path'; import { hasVisibleTextEditor, isTextEditor } from '../../../system/utils'; import { IpcMessage, onIpc } from '../../../webviews/protocol'; import { WebviewViewBase } from '../../../webviews/webviewViewBase'; @@ -123,12 +124,13 @@ export class TimelineWebviewView extends WebviewViewBase { const repository = this.container.git.getRepository(this._context.uri); if (repository == null) return; - const commandArgs: ShowQuickCommitCommandArgs = { - repoPath: repository.path, - sha: params.data.id, + const commandArgs: ShowQuickCommitFileCommandArgs = { + revisionUri: this.container.git + .getRevisionUri(params.data.id, getBestPath(this._context.uri), repository.uri) + .toString(true), }; - void commands.executeCommand(Commands.ShowQuickCommit, commandArgs); + void commands.executeCommand(Commands.ShowQuickCommitFile, commandArgs); // const commandArgs: DiffWithPreviousCommandArgs = { // line: 0,