浏览代码

Fixes VFW not opening commit file quickpick

main
Eric Amodio 2 年前
父节点
当前提交
6d441e80d0
共有 5 个文件被更改,包括 25 次插入20 次删除
  1. +1
    -0
      CHANGELOG.md
  2. +7
    -7
      src/commands/showQuickCommitFile.ts
  3. +3
    -3
      src/git/gitProviderService.ts
  4. +7
    -5
      src/plus/webviews/timeline/timelineWebview.ts
  5. +7
    -5
      src/plus/webviews/timeline/timelineWebviewView.ts

+ 1
- 0
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

+ 7
- 7
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;

+ 3
- 3
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;

+ 7
- 5
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,

+ 7
- 5
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,

正在加载...
取消
保存