##// END OF EJS Templates
pr: Return update response objects instead of tuples.
Martin Bornhold -
r1074:175746dd default
parent child Browse files
Show More
@@ -511,7 +511,6 b' class PullRequestModel(BaseModel):'
511 511 and return the new pull request version and the list
512 512 of commits processed by this update action
513 513 """
514
515 514 pull_request = self.__get_pull_request(pull_request)
516 515 source_ref_type = pull_request.source_ref_parts.type
517 516 source_ref_name = pull_request.source_ref_parts.name
@@ -521,13 +520,19 b' class PullRequestModel(BaseModel):'
521 520 log.debug(
522 521 "Skipping update of pull request %s due to ref type: %s",
523 522 pull_request, source_ref_type)
524 return (None, None)
523 return UpdateResponse(
524 success=False,
525 reason=UpdateFailureReason.WRONG_REF_TPYE,
526 old=pull_request, new=None, changes=None)
525 527
526 528 source_repo = pull_request.source_repo.scm_instance()
527 529 source_commit = source_repo.get_commit(commit_id=source_ref_name)
528 530 if source_ref_id == source_commit.raw_id:
529 531 log.debug("Nothing changed in pull request %s", pull_request)
530 return (None, None)
532 return UpdateResponse(
533 success=True,
534 reason=UpdateFailureReason.NO_CHANGE,
535 old=pull_request, new=None, changes=None)
531 536
532 537 # Finally there is a need for an update
533 538 pull_request_version = self._create_version_from_snapshot(pull_request)
@@ -611,7 +616,9 b' class PullRequestModel(BaseModel):'
611 616 self._trigger_pull_request_hook(pull_request, pull_request.author,
612 617 'update')
613 618
614 return (pull_request_version, changes)
619 return UpdateResponse(
620 success=True, reason=UpdateFailureReason.NONE,
621 old=pull_request, new=pull_request_version, changes=changes)
615 622
616 623 def _create_version_from_snapshot(self, pull_request):
617 624 version = PullRequestVersion()
General Comments 0
You need to be logged in to leave comments. Login now