From 472a619c6fedbfd2e9c0d29fd342b64601cbddf0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 24 2014 09:18:24 +0000 Subject: Add logic to the internal api to create and store in the DB new pull request --- diff --git a/progit/lib.py b/progit/lib.py index 7fb2337..2daebc3 100644 --- a/progit/lib.py +++ b/progit/lib.py @@ -96,6 +96,22 @@ def new_issue(session, repo, title, content, user): return 'Issue created' +def new_pull_request(session, repo, title, user, stop_id, start_id=None): + ''' Create a new pull request on the specified repo. ''' + request = model.PullRequest( + project_id=repo.id, + title=title, + start_id=start_id, + stop_id=stop_id, + user=user, + ) + session.add(request) + # Make sure we won't have SQLAlchemy error before we create the request + session.flush() + + return 'Request created' + + def edit_issue(session, issue, title, content): ''' Edit the specified issue. '''