From 7a186e40be97e9471517bbdceb385dd7e88fe564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 15 Apr 2015 14:33:22 +0200 Subject: [PATCH] Show last merge failure on repository status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This gives user better overview what is current state (rather than just showing there are changes to merge in both directions). Fixes #554 Signed-off-by: Michal Čihař --- docs/changes.rst | 1 + weblate/html/js/git-status.html | 16 ++++++++++++---- weblate/trans/models/changes.py | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index 6e69a7b84681..59ab3cf8378d 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -15,6 +15,7 @@ Released on ? 2015. * Simplified workflow for accepting suggestions. * Added project owners who always receive important notifications. * Allow to disable editing of monolingual template. +* More detailed repository status view. weblate 2.2 ----------- diff --git a/weblate/html/js/git-status.html b/weblate/html/js/git-status.html index 057b156e3f16..8760947add03 100644 --- a/weblate/html/js/git-status.html +++ b/weblate/html/js/git-status.html @@ -9,16 +9,24 @@

{% trans "Repository status" %}

{% if needs_commit %} -

{% trans "There are some not committed changes!" %}

+ {% endif %} +{% if changes.0.is_merge_failure %} + +{% else %} {% if object.git_needs_merge %} -

{% trans "The remote repository needs to be merged!" %}

+ {% endif %} {% if object.git_needs_push %} -

{% trans "There are some new commits in the local repository!" %}

+ {% endif %} {% if not needs_commit and not object.git_needs_merge and not object.git_needs_push %} -

{% trans "The local repository is up to date." %}

+ +{% endif %} {% endif %} {% if object.subproject_set %} diff --git a/weblate/trans/models/changes.py b/weblate/trans/models/changes.py index 88e1e43984e8..26be35cf651a 100644 --- a/weblate/trans/models/changes.py +++ b/weblate/trans/models/changes.py @@ -216,6 +216,11 @@ class Change(models.Model): ACTION_FAILED_REBASE, )) + ACTIONS_MERGE_FAILURE = set(( + ACTION_FAILED_MERGE, + ACTION_FAILED_REBASE, + )) + unit = models.ForeignKey('Unit', null=True) subproject = models.ForeignKey('SubProject', null=True) translation = models.ForeignKey('Translation', null=True) @@ -243,6 +248,9 @@ def __unicode__(self): 'user': self.get_user_display(False), } + def is_merge_failure(self): + return self.action in self.ACTIONS_MERGE_FAILURE + def get_user_display(self, icon=True): return get_user_display(self.user, icon, link=True)