# HG changeset patch # User Martin Bornhold # Date 2016-10-27 08:24:33 # Node ID 5b96938c9870d9aa45f27d340df000555720be1f # Parent 394d4ccb4701a475e4b9da3d4fda21d81f130c84 pr: Add update status messages dict. diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -40,7 +40,7 @@ from rhodecode.lib.markup_renderer impor from rhodecode.lib.utils import action_logger from rhodecode.lib.utils2 import safe_unicode, safe_str, md5_safe from rhodecode.lib.vcs.backends.base import ( - Reference, MergeResponse, MergeFailureReason) + Reference, MergeResponse, MergeFailureReason, UpdateFailureReason) from rhodecode.lib.vcs.conf import settings as vcs_settings from rhodecode.lib.vcs.exceptions import ( CommitDoesNotExistError, EmptyRepositoryError) @@ -100,6 +100,25 @@ class PullRequestModel(BaseModel): 'reference is missing.'), } + UPDATE_STATUS_MESSAGES = { + UpdateFailureReason.NONE: lazy_ugettext( + 'Pull request update successful.'), + UpdateFailureReason.UNKNOWN: lazy_ugettext( + 'Pull request update failed because of an unknown error.'), + UpdateFailureReason.NO_CHANGE: lazy_ugettext( + 'No update needed because the source reference is already ' + 'up to date.'), + UpdateFailureReason.WRONG_REF_TPYE: lazy_ugettext( + 'Pull request cannot be updated because the reference type is ' + 'not supported for an update.'), + UpdateFailureReason.MISSING_TARGET_REF: lazy_ugettext( + 'This pull request cannot be updated because the target ' + 'reference is missing.'), + UpdateFailureReason.MISSING_SOURCE_REF: lazy_ugettext( + 'This pull request cannot be updated because the source ' + 'reference is missing.'), + } + def __get_pull_request(self, pull_request): return self._get_instance(PullRequest, pull_request)