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