Skip to content

Commit

Permalink
Show last merge failure on repository status
Browse files Browse the repository at this point in the history
This gives user better overview what is current state (rather than just
showing there are changes to merge in both directions).

Fixes WeblateOrg#554

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Apr 15, 2015
1 parent 87b360f commit 7a186e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------
Expand Down
16 changes: 12 additions & 4 deletions weblate/html/js/git-status.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@
<div class="panel-heading"><h4 class="panel-title">{% trans "Repository status" %}</h4></div>
<div class="panel-body">
{% if needs_commit %}
<p>{% trans "There are some not committed changes!" %}</p>
<div class="alert alert-info" role="alert">{% trans "There are some not committed changes!" %}</div>
{% endif %}
{% if changes.0.is_merge_failure %}
<div class="alert alert-danger" role="alert">
<p>{% trans "There has been a merge failure on the repository:" %}</p>
<pre>{{ changes.0.target }}</pre>
<p><a href="{% documentation "faq" "merge" %}">{% trans "Check our FAQ for information how to resolve this." %}</a></p>
</div>
{% else %}
{% if object.git_needs_merge %}
<p>{% trans "The remote repository needs to be merged!" %}</p>
<div class="alert alert-warning" role="alert">{% trans "The remote repository needs to be merged!" %}</div>
{% endif %}
{% if object.git_needs_push %}
<p>{% trans "There are some new commits in the local repository!" %}</p>
<div class="alert alert-warning" role="alert">{% trans "There are some new commits in the local repository!" %}</div>
{% endif %}
{% if not needs_commit and not object.git_needs_merge and not object.git_needs_push %}
<p>{% trans "The local repository is up to date." %}</p>
<div class="alert alert-success" role="alert">{% trans "The local repository is up to date." %}</div>
{% endif %}
{% endif %}

{% if object.subproject_set %}
Expand Down
8 changes: 8 additions & 0 deletions weblate/trans/models/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 7a186e4

Please sign in to comment.