Show More
@@ -519,14 +519,8 b' class PullrequestsController(BaseRepoCon' | |||||
519 |
|
519 | |||
520 | def _update_commits(self, pull_request): |
|
520 | def _update_commits(self, pull_request): | |
521 | resp = PullRequestModel().update_commits(pull_request) |
|
521 | resp = PullRequestModel().update_commits(pull_request) | |
522 | msg = PullRequestModel.UPDATE_STATUS_MESSAGES[resp.reason] |
|
|||
523 |
|
522 | |||
524 | # Abort if pull request update failed. |
|
523 | if resp.success: | |
525 | if not resp.success: |
|
|||
526 | h.flash(msg, category='error') |
|
|||
527 | return |
|
|||
528 |
|
||||
529 | if resp.reason == UpdateFailureReason.NONE: |
|
|||
530 | msg = _( |
|
524 | msg = _( | |
531 | u'Pull request updated to "{source_commit_id}" with ' |
|
525 | u'Pull request updated to "{source_commit_id}" with ' | |
532 | u'{count_added} added, {count_removed} removed commits.') |
|
526 | u'{count_added} added, {count_removed} removed commits.') | |
@@ -561,11 +555,14 b' class PullrequestsController(BaseRepoCon' | |||||
561 | channelstream_request( |
|
555 | channelstream_request( | |
562 | channelstream_config, [payload], '/message', |
|
556 | channelstream_config, [payload], '/message', | |
563 | raise_exc=False) |
|
557 | raise_exc=False) | |
564 | elif resp.reason == UpdateFailureReason.NO_CHANGE: |
|
|||
565 | # Display a warning if no update is needed. |
|
|||
566 | h.flash(msg, category='warning') |
|
|||
567 | else: |
|
558 | else: | |
568 | h.flash(msg, category='error') |
|
559 | msg = PullRequestModel.UPDATE_STATUS_MESSAGES[resp.reason] | |
|
560 | warning_reasons = [ | |||
|
561 | UpdateFailureReason.NO_CHANGE, | |||
|
562 | UpdateFailureReason.WRONG_REF_TPYE, | |||
|
563 | ] | |||
|
564 | category = 'warning' if resp.reason in warning_reasons else 'error' | |||
|
565 | h.flash(msg, category=category) | |||
569 |
|
566 | |||
570 | @auth.CSRFRequired() |
|
567 | @auth.CSRFRequired() | |
571 | @LoginRequired() |
|
568 | @LoginRequired() |
@@ -537,7 +537,7 b' class PullRequestModel(BaseModel):' | |||||
537 | if source_ref_id == source_commit.raw_id: |
|
537 | if source_ref_id == source_commit.raw_id: | |
538 | log.debug("Nothing changed in pull request %s", pull_request) |
|
538 | log.debug("Nothing changed in pull request %s", pull_request) | |
539 | return UpdateResponse( |
|
539 | return UpdateResponse( | |
540 |
success= |
|
540 | success=False, | |
541 | reason=UpdateFailureReason.NO_CHANGE, |
|
541 | reason=UpdateFailureReason.NO_CHANGE, | |
542 | old=pull_request, new=None, changes=None) |
|
542 | old=pull_request, new=None, changes=None) | |
543 |
|
543 |
General Comments 0
You need to be logged in to leave comments.
Login now