Show More
@@ -45,7 +45,7 b' from rhodecode.lib.auth import (' | |||
|
45 | 45 | from rhodecode.lib.channelstream import channelstream_request |
|
46 | 46 | from rhodecode.lib.utils import jsonify |
|
47 | 47 | from rhodecode.lib.utils2 import safe_int, safe_str, str2bool, safe_unicode |
|
48 | from rhodecode.lib.vcs.backends.base import EmptyCommit | |
|
48 | from rhodecode.lib.vcs.backends.base import EmptyCommit, UpdateFailureReason | |
|
49 | 49 | from rhodecode.lib.vcs.exceptions import ( |
|
50 | 50 | EmptyRepositoryError, CommitDoesNotExistError, RepositoryRequirementError) |
|
51 | 51 | from rhodecode.lib.diffs import LimitedDiffContainer |
@@ -518,31 +518,31 b' class PullrequestsController(BaseRepoCon' | |||
|
518 | 518 | return |
|
519 | 519 | |
|
520 | 520 | def _update_commits(self, pull_request): |
|
521 | try: | |
|
522 | if PullRequestModel().has_valid_update_type(pull_request): | |
|
523 | updated_version, changes = PullRequestModel().update_commits( | |
|
524 | pull_request) | |
|
525 | if updated_version: | |
|
521 | resp = PullRequestModel().update_commits(pull_request) | |
|
522 | msg = PullRequestModel.UPDATE_STATUS_MESSAGES[resp.reason] | |
|
523 | ||
|
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: | |
|
526 | 530 |
|
|
527 | 531 |
|
|
528 |
|
|
|
529 | u'commits.' | |
|
530 | ).format( | |
|
532 | u'{count_added} added, {count_removed} removed commits.') | |
|
533 | msg = msg.format( | |
|
531 | 534 |
|
|
532 |
|
|
|
533 |
|
|
|
535 | count_added=len(resp.changes.added), | |
|
536 | count_removed=len(resp.changes.removed)) | |
|
534 | 537 |
|
|
538 | ||
|
535 | 539 |
|
|
536 |
|
|
|
537 | 'rhodecode_plugins', {}) | |
|
538 | channelstream_config = rhodecode_plugins.get( | |
|
539 | 'channelstream', {}) | |
|
540 | rhodecode_plugins = getattr(registry, 'rhodecode_plugins', {}) | |
|
541 | channelstream_config = rhodecode_plugins.get('channelstream', {}) | |
|
540 | 542 |
|
|
541 |
|
|
|
542 |
|
|
|
543 |
|
|
|
544 | _('Reload page') | |
|
545 | ) | |
|
543 | message = msg + ( | |
|
544 | ' - <a onclick="window.location.reload()">' | |
|
545 | '<strong>{}</strong></a>'.format(_('Reload page'))) | |
|
546 | 546 |
|
|
547 | 547 |
|
|
548 | 548 |
|
@@ -558,20 +558,14 b' class PullrequestsController(BaseRepoCon' | |||
|
558 | 558 |
|
|
559 | 559 |
|
|
560 | 560 |
|
|
561 |
|
|
|
562 | '/message', raise_exc=False) | |
|
563 |
|
|
|
564 | h.flash(_("Nothing changed in pull request."), | |
|
565 | category='warning') | |
|
561 | channelstream_request( | |
|
562 | channelstream_config, [payload], '/message', | |
|
563 | 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') | |
|
566 | 567 |
|
|
567 | msg = _( | |
|
568 | u"Skipping update of pull request due to reference " | |
|
569 | u"type: {reference_type}" | |
|
570 | ).format(reference_type=pull_request.source_ref_parts.type) | |
|
571 | h.flash(msg, category='warning') | |
|
572 | except CommitDoesNotExistError: | |
|
573 | h.flash( | |
|
574 | _(u'Update failed due to missing commits.'), category='error') | |
|
568 | h.flash(msg, category='error') | |
|
575 | 569 | |
|
576 | 570 | @auth.CSRFRequired() |
|
577 | 571 | @LoginRequired() |
General Comments 0
You need to be logged in to leave comments.
Login now