This commit is contained in:
2026-03-05 12:05:57 +00:00
parent cd6a97dd2d
commit 6260e90b09
8 changed files with 162 additions and 306 deletions

View File

@@ -230,7 +230,7 @@ export class ConnectionManager {
try {
if (conn.providerType === 'gitlab') {
const gitlabClient = new plugins.gitlabClient.GitLabClient(conn.baseUrl, conn.token);
const group = await gitlabClient.getGroupByPath(conn.groupFilter);
const group = await gitlabClient.getGroup(conn.groupFilter);
conn.groupFilterId = String(group.id);
logger.info(`Resolved group filter "${conn.groupFilter}" to ID ${conn.groupFilterId}`);
} else {

View File

@@ -522,7 +522,7 @@ export class SyncManager {
for (const segment of groupSegments) {
currentPath = currentPath ? `${currentPath}/${segment}` : segment;
try {
const group = await client.getGroupByPath(currentPath);
const group = await client.getGroup(currentPath);
parentId = group.id;
} catch {
// Group doesn't exist — create it
@@ -533,7 +533,7 @@ export class SyncManager {
} catch (createErr: any) {
// 409 = already exists (race condition), try fetching again
if (String(createErr).includes('409') || String(createErr).includes('already')) {
const group = await client.getGroupByPath(currentPath);
const group = await client.getGroup(currentPath);
parentId = group.id;
} else {
throw createErr;
@@ -558,7 +558,7 @@ export class SyncManager {
try {
// Check if project exists by path
await client.getGroupByPath(projectPath);
await client.getGroup(projectPath);
// If this succeeds, it's actually a group, not a project... unlikely but handle
} catch {
// Project doesn't exist as a group path; try creating it
@@ -1107,7 +1107,7 @@ export class SyncManager {
if (!targetProject) return;
const client = new plugins.gitlabClient.GitLabClient(targetConn.baseUrl, targetConn.token);
const protectedBranches = await client.getProtectedBranches(targetProject.id);
const protectedBranches = await client.requestGetProtectedBranches(targetProject.id);
if (protectedBranches.length === 0) return;
// Get list of branches in the local mirror (= source branches)
@@ -1119,7 +1119,7 @@ export class SyncManager {
for (const pb of protectedBranches) {
if (!localBranches.has(pb.name)) {
logger.syncLog('info', `Unprotecting stale branch "${pb.name}" on ${targetFullPath}`, 'api');
await client.unprotectBranch(targetProject.id, pb.name);
await client.requestUnprotectBranch(targetProject.id, pb.name);
}
}
} catch (err) {
@@ -1666,14 +1666,14 @@ export class SyncManager {
// Walk the basePath to find the parent group, then create "obsolete" subgroup
let parentId: number | undefined;
if (basePath) {
const parentGroup = await client.getGroupByPath(basePath);
const parentGroup = await client.getGroup(basePath);
parentId = parentGroup.id;
}
// Try to get existing obsolete group
const obsoletePath = basePath ? `${basePath}/obsolete` : 'obsolete';
try {
const group = await client.getGroupByPath(obsoletePath);
const group = await client.getGroup(obsoletePath);
return { type: 'gitlab', groupId: group.id };
} catch {
// Doesn't exist — create it
@@ -1684,7 +1684,7 @@ export class SyncManager {
return { type: 'gitlab', groupId: newGroup.id };
} catch (createErr: any) {
if (String(createErr).includes('409') || String(createErr).includes('already')) {
const group = await client.getGroupByPath(obsoletePath);
const group = await client.getGroup(obsoletePath);
return { type: 'gitlab', groupId: group.id };
}
throw createErr;