if p2_id: store.execute("delete from pullreq where from_project=%s", p2_id) store.commit() def setup2repos(proj1, proj2): path = proj1.git_real_path with clone(path) as workdir: with open(join(workdir, 'origin'), 'w') as f: f.write('origin') path = proj2.git_real_path with clone(path) as workdir: with open(join(workdir, 'origin'), 'w') as f: f.write('modified') project = Project.add( p1_name, owner_id="testuser", summary="test", product="") assert project project_fork = Project.add( p2_name, owner_id="testuser", summary="test", product="", fork_from=project.id) setup2repos(project, project_fork) pullreq1 = PullRequest.open(project_fork, 'master', project, 'master') ticket1 = Ticket.add(project.id, 'title', 'content', 'testuser') pullreq1.insert(ticket1.ticket_number) print "PR has been built at: %s" % (DOMAIN + ticket1.url)