Show More
@@ -44,7 +44,6 b' class TestCreatePullRequestApi(object):' | |||
|
44 | 44 | 'target_repo': 'tests/target_repo', |
|
45 | 45 | 'source_ref': 'branch:default:initial', |
|
46 | 46 | 'target_ref': 'branch:default:new-feature', |
|
47 | 'title': 'Test PR 1' | |
|
48 | 47 | } |
|
49 | 48 | for key in required_data: |
|
50 | 49 | data = required_data.copy() |
@@ -574,7 +574,7 b' def comment_pull_request(' | |||
|
574 | 574 | @jsonrpc_method() |
|
575 | 575 | def create_pull_request( |
|
576 | 576 | request, apiuser, source_repo, target_repo, source_ref, target_ref, |
|
577 | title, description=Optional(''), reviewers=Optional(None)): | |
|
577 | title=Optional(''), description=Optional(''), reviewers=Optional(None)): | |
|
578 | 578 | """ |
|
579 | 579 | Creates a new pull request. |
|
580 | 580 | |
@@ -595,7 +595,7 b' def create_pull_request(' | |||
|
595 | 595 | :type source_ref: str |
|
596 | 596 | :param target_ref: Set the target ref name. |
|
597 | 597 | :type target_ref: str |
|
598 |
:param title: Set the pull request title |
|
|
598 | :param title: Optionally Set the pull request title, it's generated otherwise | |
|
599 | 599 | :type title: str |
|
600 | 600 | :param description: Set the pull request description. |
|
601 | 601 | :type description: Optional(str) |
@@ -666,6 +666,15 b' def create_pull_request(' | |||
|
666 | 666 | except ValueError as e: |
|
667 | 667 | raise JSONRPCError('Reviewers Validation: {}'.format(e)) |
|
668 | 668 | |
|
669 | title = Optional.extract(title) | |
|
670 | if not title: | |
|
671 | title_source_ref = source_ref.split(':', 2)[1] | |
|
672 | title = PullRequestModel().generate_pullrequest_title( | |
|
673 | source=source_repo, | |
|
674 | source_ref=title_source_ref, | |
|
675 | target=target_repo | |
|
676 | ) | |
|
677 | ||
|
669 | 678 | pull_request = PullRequestModel().create( |
|
670 | 679 | created_by=apiuser.user_id, |
|
671 | 680 | source_repo=source_repo, |
@@ -676,6 +685,7 b' def create_pull_request(' | |||
|
676 | 685 | reviewers=reviewers, |
|
677 | 686 | title=title, |
|
678 | 687 | description=Optional.extract(description), |
|
688 | reviewer_data=reviewer_rules, | |
|
679 | 689 | auth_user=apiuser |
|
680 | 690 | ) |
|
681 | 691 |
General Comments 0
You need to be logged in to leave comments.
Login now