Skip to content

Commit b491f8f

Browse files
author
guqiankun
committed
chore: 增加创建分支配置
1 parent 7558375 commit b491f8f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/code-api/src/common/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface ICodePlatformConfig {
1212
parse(hash: string): [number, number] | null;
1313
format(lineNumbers: [number, number]): string;
1414
};
15+
createBranch?: boolean;
1516
}
1617

1718
// 代码托管平台配置
@@ -42,6 +43,7 @@ export const CODE_PLATFORM_CONFIG: Record<ICodePlatform, ICodePlatformConfig> =
4243
return `#L${startLineNumber}-${endLineNumber}`;
4344
},
4445
},
46+
createBranch: true,
4547
},
4648
[CodePlatform.github]: {
4749
platform: CodePlatform.github,
@@ -111,6 +113,7 @@ export const CODE_PLATFORM_CONFIG: Record<ICodePlatform, ICodePlatformConfig> =
111113
return `#L${startLineNumber}-${endLineNumber}`;
112114
},
113115
},
116+
createBranch: true,
114117
},
115118
};
116119

packages/code-service/src/code-service.contribution.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { CodeModelService } from './code-model.service';
4242
import { RefType, ICodeServiceConfig, CodePlatform } from './types';
4343
import { Configure } from './config.service';
4444
import { ISCMRepository, SCMService, ISCMResource, ISCMResourceGroup } from '@opensumi/ide-scm';
45+
import { CODE_PLATFORM_CONFIG } from '@alipay/alex-code-api';
4546

4647
namespace CODE_SERVICE_COMMANDS {
4748
const CATEGORY = 'CodeService';
@@ -276,7 +277,7 @@ export class CodeContribution
276277
await repo.refsInitialized;
277278
const getShortCommit = (commit: string) => (commit || '').substr(0, 8);
278279
const createBranch: { name: string; commit: string; type: PickBranch }[] = [];
279-
if (repo.platform == CodePlatform.antcode || repo.platform == CodePlatform.gitlink) {
280+
if (CODE_PLATFORM_CONFIG[repo.platform].createBranch) {
280281
createBranch.push(
281282
{
282283
name: localize('code-service.command.create-branch'),

0 commit comments

Comments
 (0)