|
@@ -450,15 +450,16 @@ def main(num_events=1, extra_events=False):
|
|
|
raw_commits = generate_commits(user)
|
|
|
|
|
|
try:
|
|
|
- repo, _ = Repository.objects.get_or_create(
|
|
|
- organization_id=org.id,
|
|
|
- provider='integrations:github',
|
|
|
- external_id='example/example',
|
|
|
- defaults={
|
|
|
- 'name': 'Example Repo',
|
|
|
- 'url': 'https://github.com/example/example',
|
|
|
- }
|
|
|
- )
|
|
|
+ with transaction.atomic():
|
|
|
+ repo, _ = Repository.objects.get_or_create(
|
|
|
+ organization_id=org.id,
|
|
|
+ provider='integrations:github',
|
|
|
+ external_id='example/example',
|
|
|
+ defaults={
|
|
|
+ 'name': 'Example Repo',
|
|
|
+ 'url': 'https://github.com/example/example',
|
|
|
+ }
|
|
|
+ )
|
|
|
except IntegrityError:
|
|
|
# for users with legacy github plugin
|
|
|
# upgrade to the new integration
|