3728c245d3
- Add GitHubAdapter and GitLabAdapter with URL parsing - Create provider factory in apps/api/app/git/providers/ - Implement clone, fetch, push in LocalGitOperations - Add repository_connections router with CRUD and SSH key endpoints - Create RepositoryConnection schema with validation - Update models and routers __init__.py for new components - Add comprehensive tests for git operations
18 lines
503 B
Python
18 lines
503 B
Python
from app.git.provider import GitProvider
|
|
from app.git.types import ProviderKind
|
|
|
|
from .github import GitHubAdapter
|
|
from .gitlab import GitLabAdapter
|
|
|
|
PROVIDERS: dict[ProviderKind, type[GitProvider]] = {
|
|
ProviderKind.github: GitHubAdapter,
|
|
ProviderKind.gitlab: GitLabAdapter,
|
|
}
|
|
|
|
|
|
def get_provider(kind: ProviderKind) -> GitProvider:
|
|
provider_class = PROVIDERS.get(kind)
|
|
if provider_class is None:
|
|
raise ValueError(f"Unsupported provider kind: {kind}")
|
|
return provider_class()
|