|
1 | | -import { CodeAPI, CodePlatform, CommitFileChange, CommitParams, CommitRecord } from '@codeblitzjs/ide-code-api'; |
| 1 | +import { CodeAPI, CodePlatform, CommitFileChange, CommitParams, CommitRecord, EntryInfo } from '@codeblitzjs/ide-code-api'; |
2 | 2 | import { Autowired } from '@opensumi/di'; |
3 | 3 | import { IClipboardService, IOpenerService } from '@opensumi/ide-core-browser'; |
4 | 4 | import { Command, CommandContribution, CommandRegistry, Disposable, Domain } from '@opensumi/ide-core-common'; |
@@ -58,6 +58,7 @@ export class CommandsContribution extends Disposable implements CommandContribut |
58 | 58 | CODE_SERVICE_COMMANDS.COMMIT_DETAIL, |
59 | 59 | CODE_SERVICE_COMMANDS.COMMIT_COMPARE, |
60 | 60 | CODE_SERVICE_COMMANDS.COMMIT_FILE, |
| 61 | + CODE_SERVICE_COMMANDS.GET_ENTRY_INFO, |
61 | 62 | CODE_SERVICE_COMMANDS.REMOTE_URL, |
62 | 63 | CODE_SERVICE_COMMANDS.CHECKOUT_BRANCH, |
63 | 64 | CODE_SERVICE_COMMANDS.CHECKOUT_COMMIT, |
@@ -244,9 +245,21 @@ export class CommandsContribution extends Disposable implements CommandContribut |
244 | 245 | options?: any, |
245 | 246 | ): Promise<Uint8Array> { |
246 | 247 | const repo = this.codeModel.getRepository(repoPath); |
247 | | - if (!repo) throw new Error(`${filePath} not exists`); |
| 248 | + if (!repo) throw new Error(`repo ${repoPath} not exists`); |
248 | 249 | return repo.request.getBlobByCommitPath(commitHash, filePath, options); |
249 | 250 | } |
| 251 | + async getEntryInfo( |
| 252 | + repoPath: string, |
| 253 | + refName: string, |
| 254 | + filePath: string, |
| 255 | + ): Promise<EntryInfo> { |
| 256 | + const repo = this.codeModel.getRepository(repoPath); |
| 257 | + if (!repo) throw new Error(`repo ${repoPath} not exists`); |
| 258 | + return repo.request.getEntryInfo({ |
| 259 | + ref_name: refName, |
| 260 | + path: filePath, |
| 261 | + }); |
| 262 | + } |
250 | 263 |
|
251 | 264 | async remoteUrl(repoPath: string): Promise<string | null> { |
252 | 265 | const repo = this.codeModel.getRepository(repoPath); |
|
0 commit comments