Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit e5a7000

Browse files
committed
remove this chunk
1 parent f9d8307 commit e5a7000

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

upload/views/helpers.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import logging
21
import typing
32

4-
from shared.django_apps.core.models import Commit
5-
63
from codecov_auth.models import Owner, Service
74
from core.models import Repository
85

9-
log = logging.getLogger(__name__)
10-
116

127
def get_repository_and_owner_from_string(
138
service: Service, repo_identifier: str
@@ -50,45 +45,3 @@ def get_repository_from_string(
5045
service=service, repo_identifier=repo_identifier
5146
)
5247
return repository
53-
54-
55-
def get_repository_and_owner_from_slug_and_commit(
56-
slug: str, commitid: str
57-
) -> tuple[Repository | None, Owner | None]:
58-
if "::::" not in slug:
59-
return None, None
60-
61-
owner_username, repository_name = slug.rsplit("::::", 1)
62-
63-
# formatting for GL subgroups
64-
if ":::" in owner_username:
65-
owner_username = owner_username.replace(":::", ":")
66-
67-
matching_repositories = Repository.objects.filter(
68-
author__username=owner_username, name=repository_name
69-
).select_related("author")
70-
if matching_repositories.count() == 1:
71-
log.info(
72-
"get_repository_and_owner_from_slug_and_commit success",
73-
extra=dict(slug=slug),
74-
)
75-
repository = matching_repositories.first()
76-
return repository, repository.author
77-
else:
78-
# commit might not exist yet (if this is first upload for it)
79-
try:
80-
# Commit has UniqueConstraint on commitid + repository
81-
commit = Commit.objects.select_related(
82-
"repository", "repository__author"
83-
).get(commitid=commitid, repository__in=matching_repositories)
84-
log.info(
85-
"get_repository_and_owner_from_slug_and_commit multiple matches success",
86-
extra=dict(slug=slug),
87-
)
88-
return commit.repository, commit.repository.author
89-
except (Commit.DoesNotExist, Commit.MultipleObjectsReturned):
90-
log.info(
91-
"get_repository_and_owner_from_slug_and_commit fail",
92-
extra=dict(slug=slug),
93-
)
94-
return None, None

0 commit comments

Comments
 (0)