Add imported tasks to master branch of relevant project

Change-Id: I65027746331e2ed44aecc4c8333825a00c4b9237
This commit is contained in:
Adam Coldrick 2017-01-23 01:19:41 +00:00
parent a7bbc0575f
commit 19b4ef8b0f
1 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,7 @@ from openid import cryptutil
import storyboard.common.event_types as event_types
from storyboard.db.api import base as db_api
from storyboard.db.models import Branch
from storyboard.db.models import Comment
from storyboard.db.models import Project
from storyboard.db.models import Story
@ -54,6 +55,14 @@ class LaunchpadWriter(object):
"it first." % (project_name)
sys.exit(1)
self.branch = db_api.model_query(Branch, self.session) \
.filter_by(project_id=self.project.id, name='master') \
.first()
if not self.branch:
print "No master branch found for project %s, please create " \
"one first." % (project_name)
sys.exit(1)
def write_tags(self, bug):
"""Extracts the tags from a launchpad bug, seeds/loads them in the
StoryBoard database, and returns a list of the corresponding entities.
@ -219,6 +228,7 @@ class LaunchpadWriter(object):
'title': title,
'assignee_id': assignee.id if assignee else None,
'project_id': self.project.id,
'branch_id': self.branch.id,
'story_id': launchpad_id,
'created_at': created_at,
'updated_at': updated_at,