History

feat(source-control): add Bitbucket & Azure Devops providers (#2473)

Julius Marminge committed 6 months agov0.0.22-nightly.20260504.196

Commit 91a03e01 parent d501ebe59 files · +5834 −2327Browse files

Showing the changes to apps/server/src/sourceControl/SourceControlProvider.ts (1 of 59 files). Show all

Unified · Split

apps/server/src/sourceControl/SourceControlProvider.ts+27−0
@@ -21,6 +21,33 @@ export interface SourceControlRefSelector { · 20 unmodified lines
21 readonly repository?: string;21 readonly repository?: string;
22}22}
23 23
24export function parseSourceControlOwnerRef(
25 headSelector: string,
26): SourceControlRefSelector | undefined {
27 const match = /^([^:/\s]+):(.+)$/u.exec(headSelector.trim());
28 const owner = match?.[1]?.trim();
29 const refName = match?.[2]?.trim();
30 return owner && refName ? { owner, refName } : undefined;
31}
32
33export function normalizeSourceBranch(headSelector: string): string {
34 return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
35}
36
37export function sourceBranch(input: {
38 readonly headSelector: string;
39 readonly source?: SourceControlRefSelector;
40}): string {
41 return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
42}
43
44export function sourceControlRefFromInput(input: {
45 readonly headSelector: string;
46 readonly source?: SourceControlRefSelector;
47}): SourceControlRefSelector | undefined {
48 return input.source ?? parseSourceControlOwnerRef(input.headSelector);
49}
50
24export interface SourceControlProviderShape {51export interface SourceControlProviderShape {
25 readonly kind: SourceControlProviderKind;52 readonly kind: SourceControlProviderKind;
26 readonly listChangeRequests: (input: {53 readonly listChangeRequests: (input: {