MCPcopy Index your code
hub / github.com/conwnet/github1s / getCodeReviewChangedFiles

Function getCodeReviewChangedFiles

extensions/github1s/src/changes/files.ts:22–50  ·  view source on GitHub ↗
(
	codeReview: adapterTypes.CodeReview & { sourceSha: string; targetSha: string },
)

Source from the content-addressed store, hash-verified

20
21// get the change files of a codeReview
22export const getCodeReviewChangedFiles = async (
23 codeReview: adapterTypes.CodeReview & { sourceSha: string; targetSha: string },
24) => {
25 const scheme = adapterManager.getCurrentScheme();
26 const { repo } = await router.getState();
27 const baseRootUri = vscode.Uri.parse('').with({
28 scheme: scheme,
29 authority: `${repo}+${codeReview.targetSha}`,
30 path: '/',
31 });
32 const headRootUri = baseRootUri.with({
33 authority: `${repo}+${codeReview.sourceSha}`,
34 });
35
36 const repository = Repository.getInstance(scheme, repo);
37 const changedFiles = await repository.getCodeReviewChangedFiles(codeReview.id);
38
39 return changedFiles.map((changedFile) => {
40 // the `previous_filename` field only exists in `RENAMED` file,
41 // fallback to `filename` otherwise
42 const baseFilePath = changedFile.previousPath || changedFile.path;
43 const headFilePath = changedFile.path;
44 return {
45 baseFileUri: vscode.Uri.joinPath(baseRootUri, baseFilePath),
46 headFileUri: vscode.Uri.joinPath(headRootUri, headFilePath),
47 status: changedFile.status,
48 };
49 });
50};
51
52export const getCommitChangedFiles = async (commit: adapterTypes.Commit) => {
53 const currentAdapter = adapterManager.getCurrentAdapter();

Callers 2

getChangedFilesFunction · 0.85

Calls 4

getCurrentSchemeMethod · 0.80
getStateMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected