From e3d4830f4cffff8af425b18b12b9cfc88f325605 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Mar 16 2016 08:57:25 +0000 Subject: fill initial comment of the create PR form if only one commit When creating a Pull request with only 1 commit in it, the Pull Request title is automatically filled out with the title of the only commit. Now, in the case of having one commit message, the body text of the commit is now automatically filled out in the new pull request description field (inital comment field) too. --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 076fede..fed6f06 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -984,8 +984,12 @@ def new_request_pull(repo, branch_to, branch_from, username=None): if not is_repo_admin(repo): form = None + # if the pull request we are creating only has one commit, + # we automatically fill out the form fields for the PR with + # the commit title and bodytext if len(diff_commits) == 1 and form: form.title.data = diff_commits[0].message.strip().split('\n')[0] + form.initial_comment.data = diff_commits[0].message.partition('\n')[2] # Get the contributing templates from the requests git repo contributing = None