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

Function commandOpenFileNextRevision

extensions/github1s/src/commands/editor.ts:118–145  ·  view source on GitHub ↗
(fileUri: vscode.Uri)

Source from the content-addressed store, hash-verified

116
117// show the file's diff between current commit and next commit
118const commandOpenFileNextRevision = async (fileUri: vscode.Uri) => {
119 const leftFileUri = await getConcreteFileUri(fileUri);
120
121 const [repo, leftCommitSha] = leftFileUri.authority.split('+').filter(Boolean);
122 const repository = Repository.getInstance(fileUri.scheme, repo);
123 const rightCommit = await repository.getNextCommit(leftCommitSha, fileUri.path.slice(1));
124
125 if (!rightCommit) {
126 return vscode.window.showInformationMessage('There is no next commit found.');
127 }
128
129 const rightFileUri = leftFileUri.with({ authority: `${repo}+${rightCommit.sha}` });
130 const hasNextRevision = !!(await repository.getNextCommit(rightCommit.sha, rightFileUri.path.slice(1)));
131
132 const query = queryString.stringify({
133 base: leftFileUri.with({ query: '' }).toString(),
134 head: rightFileUri.with({ query: '' }).toString(),
135 status: FileChangeStatus.Modified,
136 hasNextRevision,
137 });
138
139 return vscode.commands.executeCommand(
140 'vscode.diff',
141 leftFileUri.with({ query }),
142 rightFileUri.with({ query }),
143 getChangedFileDiffTitle(leftFileUri, rightFileUri, FileChangeStatus.Modified),
144 );
145};
146
147export const registerEditorCommands = (context: vscode.ExtensionContext) => {
148 return context.subscriptions.push(

Callers

nothing calls this directly

Calls 4

getChangedFileDiffTitleFunction · 0.90
getConcreteFileUriFunction · 0.85
getNextCommitMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected