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
2121 readonly repository?: string;
2222 }
2323
24+export 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+
33+export function normalizeSourceBranch(headSelector: string): string {
34+ return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
35+}
36+
37+export function sourceBranch(input: {
38+ readonly headSelector: string;
39+ readonly source?: SourceControlRefSelector;
40+}): string {
41+ return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
42+}
43+
44+export function sourceControlRefFromInput(input: {
45+ readonly headSelector: string;
46+ readonly source?: SourceControlRefSelector;
47+}): SourceControlRefSelector | undefined {
48+ return input.source ?? parseSourceControlOwnerRef(input.headSelector);
49+}
50+
2451 export interface SourceControlProviderShape {
2552 readonly kind: SourceControlProviderKind;
2653 readonly listChangeRequests: (input: {