You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/04/22 12:27:42 UTC
[6/9] allura git commit: [#7836] ticket:739 Show error to a user if
can't find merge base
[#7836] ticket:739 Show error to a user if can't find merge base
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/82863220
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/82863220
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/82863220
Branch: refs/heads/ib/7836
Commit: 82863220a4ecdd11c39e0f7e74cbda654ba55ade
Parents: 0717916
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 5 14:11:05 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Apr 22 09:44:41 2015 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 8 +++++++-
Allura/allura/templates/repo/merge_request.html | 12 ++++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/82863220/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index ce38b2b..d7b07eb 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -363,7 +363,7 @@ class MergeRequestController(object):
c.mr_dispose_form = self.mr_dispose_form
with self.req.push_downstream_context():
downstream_app = c.app
- return dict(
+ result = dict(
downstream_app=downstream_app,
req=self.req,
can_merge=self.req.can_merge(),
@@ -372,6 +372,12 @@ class MergeRequestController(object):
page=page,
limit=limit,
count=self.req.discussion_thread.post_count)
+ try:
+ result['commits'] = self.req.commits
+ except:
+ result['commits'] = []
+ result['error'] = True
+ return result
@property
def mr_widget_edit(self):
http://git-wip-us.apache.org/repos/asf/allura/blob/82863220/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index f87a894..3f5e894 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -56,7 +56,7 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
{% if req.downstream_repo %}
<p>
<a href="{{req.creator_url}}">{{req.creator_name}}</a>
- asked you to merge {{h.text.plural(req.commits|count, 'commit', 'commits')}}
+ asked you to merge {{h.text.plural(commits|count, 'commit', 'commits')}}
from <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
to {{ req.target_branch }},
{{lib.abbr_date(req.mod_date)}}
@@ -64,6 +64,14 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
<div>{{g.markdown.convert(req.description)}}</div>
+ {% if error %}
+ <div class='grid-19 error'>
+ Can't find commits to merge. Please checkout
+ <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
+ and follow the instructions to merge manually.
+ </div>
+ {% endif %}
+
{% if req.merge_allowed(c.user) %}
<div class="grid-19">
<form action="merge" method="POST">
@@ -82,7 +90,7 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
</div>
{% endif %}
- {{ c.log_widget.display(value=req.commits, app=downstream_app) }}
+ {{ c.log_widget.display(value=commits, app=downstream_app) }}
<div class="grid-19"><a href="#discussion_holder">Discuss</a></div>