提交 b65bf5ce 编写于 作者: P Peng Lyu

show commit id in the file path for comments outdated

上级 0ae17e63
......@@ -25,9 +25,9 @@ export interface GitUriOptions {
// As a mitigation for extensions like ESLint showing warnings and errors
// for git URIs, let's change the file extension of these uris to .git,
// when `replaceFileExtension` is true.
export function toGitUri(uri: Uri, ref: string, commit: string, options: GitUriOptions = {}): Uri {
export function toGitUri(uri: Uri, filePath: string, ref: string, commit: string, options: GitUriOptions = {}): Uri {
const params: GitUriParams = {
path: uri.path,
path: filePath ? filePath : uri.path,
ref,
commit: commit
};
......
......@@ -7,6 +7,7 @@
import * as vscode from 'vscode';
import { Repository } from '../models/repository';
import { fromGitUri } from '../common/uri';
import { PullRequestModel } from '../models/pullRequestModel';
export class GitContentProvider implements vscode.TextDocumentContentProvider {
private _onDidChange = new vscode.EventEmitter<vscode.Uri>();
......
......@@ -238,13 +238,12 @@ export class ReviewManager implements vscode.DecorationProvider {
if (pr.prItem.head.sha !== this._lastCommitSha && !this._updateMessageShown) {
this._updateMessageShown = true;
await vscode.window.showInformationMessage('There are updates available for this branch.', {}, 'Pull').then(result => {
let result = await vscode.window.showInformationMessage('There are updates available for this branch.', {}, 'Pull');
if (result === 'Pull') {
vscode.commands.executeCommand('git.pull').then(() => {
await vscode.commands.executeCommand('git.pull');
this._updateMessageShown = false;
});
}
});
}
const comments = await pr.getComments();
......@@ -328,8 +327,8 @@ export class ReviewManager implements vscode.DecorationProvider {
change.status,
change.fileName,
change.blobUrl,
toGitUri(vscode.Uri.parse(change.fileName), null, change.status === GitChangeType.DELETE ? '' : pr.prItem.head.sha, {}),
toGitUri(vscode.Uri.parse(change.fileName), null, change.status === GitChangeType.ADD ? '' : pr.prItem.base.sha, {}),
toGitUri(vscode.Uri.parse(change.fileName), null, null, change.status === GitChangeType.DELETE ? '' : pr.prItem.head.sha, {}),
toGitUri(vscode.Uri.parse(change.fileName), null, null, change.status === GitChangeType.ADD ? '' : pr.prItem.base.sha, {}),
this._repository.path,
change.diffHunks
);
......@@ -350,8 +349,8 @@ export class ReviewManager implements vscode.DecorationProvider {
GitChangeType.MODIFY,
fileName,
null,
toGitUri(vscode.Uri.parse(fileName), null, oldComments[0].original_commit_id, {}),
toGitUri(vscode.Uri.parse(fileName), null, oldComments[0].original_commit_id, {}),
toGitUri(vscode.Uri.parse(path.join(`commit~${commit.substr(0, 8)}`, fileName)), fileName, null, oldComments[0].original_commit_id, {}),
toGitUri(vscode.Uri.parse(path.join(`commit~${commit.substr(0, 8)}`, fileName)), fileName, null, oldComments[0].original_commit_id, {}),
this._repository.path,
[] // @todo Peng.
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册