def finish_release(self, version, **values): if not Release.is_valid_version(version): raise HookValidationError("Invalid release version: %s" % version) values.setdefault("date_released", timezone.now()) try: with transaction.atomic(): release = Release.objects.create( version=version, organization_id=self.project.organization_id, **values) except IntegrityError: release = Release.objects.get( version=version, organization_id=self.project.organization_id) release.update(**values) release.add_project(self.project) Activity.objects.create( type=Activity.RELEASE, project=self.project, ident=Activity.get_version_ident(version), data={"version": version}, datetime=values["date_released"], ) self.set_refs(release=release, **values)
def finish_release(self, version, **values): from sentry.models import Activity # Django 1.9 setup issue from sentry.models import Release # Django 1.9 setup issue if not Release.is_valid_version(version): raise HookValidationError('Invalid release version: %s' % version) values.setdefault('date_released', timezone.now()) try: with transaction.atomic(): release = Release.objects.create( version=version, organization_id=self.project.organization_id, **values ) except IntegrityError: release = Release.objects.get( version=version, organization_id=self.project.organization_id, ) release.update(**values) release.add_project(self.project) Activity.objects.create( type=Activity.RELEASE, project=self.project, ident=Activity.get_version_ident(version), data={'version': version}, datetime=values['date_released'], ) self.set_refs(release=release, **values)
def start_release(self, version, **values): if not Release.is_valid_version(version): raise HookValidationError("Invalid release version: %s" % version) try: with transaction.atomic(): release = Release.objects.create( version=version, organization_id=self.project.organization_id, **values) except IntegrityError: release = Release.objects.get( version=version, organization_id=self.project.organization_id) release.update(**values) release.add_project(self.project)
def start_release(self, version, **values): from sentry.models import Release # Django 1.9 setup issue if not Release.is_valid_version(version): raise HookValidationError('Invalid release version: %s' % version) try: with transaction.atomic(): release = Release.objects.create( version=version, organization_id=self.project.organization_id, **values ) except IntegrityError: release = Release.objects.get( version=version, organization_id=self.project.organization_id, ) release.update(**values) release.add_project(self.project)
def set_commits(self, version, commit_list): """ Commits should be ordered oldest to newest. Calling this method will remove all existing commit history. """ if not Release.is_valid_version(version): raise HookValidationError("Invalid release version: %s" % version) project = self.project try: with transaction.atomic(): release = Release.objects.create( organization_id=project.organization_id, version=version) except IntegrityError: release = Release.objects.get( organization_id=project.organization_id, version=version) release.add_project(project) release.set_commits(commit_list)