From 83bfa216e399c3f7565e147c8283946bef267e13 Mon Sep 17 00:00:00 2001 From: Martin Bornhold Date: Thu, 27 Oct 2016 10:24:33 +0200 Subject: [PATCH] pr: Add update status messages dict. --- rhodecode/model/pull_request.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py index 8a19eca8..09674802 100644 --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -40,7 +40,7 @@ from rhodecode.lib.markup_renderer import ( 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)