1414from sentry .integrations .bitbucket .constants import BITBUCKET_IP_RANGES , BITBUCKET_IPS
1515from sentry .models .commit import Commit
1616from sentry .models .commitauthor import CommitAuthor
17- from sentry .models .organization import Organization
1817from sentry .models .repository import Repository
1918from sentry .organizations .services .organization .service import organization_service
2019from sentry .plugins .providers import RepositoryProvider
21- from sentry .releases .commits import create_commit
2220from sentry .utils import json
2321from sentry .utils .email import parse_email
2422
@@ -48,10 +46,6 @@ def __call__(self, organization_id: int, event):
4846 repo .config ["name" ] = event ["repository" ]["full_name" ]
4947 repo .save ()
5048
51- try :
52- organization = Organization .objects .get (id = organization_id )
53- except Organization .DoesNotExist :
54- raise Http404 ()
5549 for change in event ["push" ]["changes" ]:
5650 for commit in change .get ("commits" , []):
5751 if RepositoryProvider .should_ignore_commit (commit ["message" ]):
@@ -73,9 +67,9 @@ def __call__(self, organization_id: int, event):
7367 author = authors [author_email ]
7468 try :
7569 with transaction .atomic (router .db_for_write (Commit )):
76- create_commit (
77- organization = organization ,
78- repo_id = repo . id ,
70+ Commit . objects . create (
71+ repository_id = repo . id ,
72+ organization_id = organization_id ,
7973 key = commit ["hash" ],
8074 message = commit ["message" ],
8175 author = author ,
0 commit comments