Skip to content

Commit 3777b24

Browse files
Copilotalexr00
andcommitted
Use review scheme URIs in openCommitChanges method
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent dba37b2 commit 3777b24

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/github/pullRequestModel.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,22 +1206,27 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
12061206
return;
12071207
}
12081208

1209-
// Create URI pairs for the multi diff editor
1209+
// Create URI pairs for the multi diff editor using review scheme
12101210
const args: [vscode.Uri, vscode.Uri | undefined, vscode.Uri | undefined][] = [];
12111211
for (const change of changes) {
1212-
const workspaceUri = vscode.Uri.file(path.resolve(repository.rootUri.fsPath, change.uri.fsPath));
1212+
const uri = vscode.Uri.file(path.resolve(repository.rootUri.fsPath, change.uri.fsPath));
1213+
const fileName = change.uri.fsPath;
12131214

12141215
if (change.status === GitChangeType.ADD) {
12151216
// For added files, show against empty
1216-
args.push([workspaceUri, undefined, workspaceUri]);
1217+
const headUri = toReviewUri(uri, fileName, undefined, commitSha, false, { base: false }, repository.rootUri);
1218+
args.push([headUri, undefined, headUri]);
12171219
} else if (change.status === GitChangeType.DELETE) {
12181220
// For deleted files, show old version against empty
1219-
const beforeUri = change.originalUri || change.uri;
1220-
args.push([workspaceUri, beforeUri, undefined]);
1221+
const baseFileName = change.status === GitChangeType.RENAME ? change.previousFileName : fileName;
1222+
const baseUri = toReviewUri(uri, baseFileName, undefined, commitSha + '~1', false, { base: true }, repository.rootUri);
1223+
args.push([uri, baseUri, undefined]);
12211224
} else {
12221225
// For modified files, show before and after
1223-
const beforeUri = change.originalUri || change.uri;
1224-
args.push([workspaceUri, beforeUri, workspaceUri]);
1226+
const baseFileName = change.status === GitChangeType.RENAME ? change.previousFileName : fileName;
1227+
const baseUri = toReviewUri(uri, baseFileName, undefined, commitSha + '~1', false, { base: true }, repository.rootUri);
1228+
const headUri = toReviewUri(uri, fileName, undefined, commitSha, false, { base: false }, repository.rootUri);
1229+
args.push([headUri, baseUri, headUri]);
12251230
}
12261231
}
12271232

0 commit comments

Comments
 (0)