You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/05/10 18:05:47 UTC
[3/4] git commit: [#6222] ticket:349 Fix commit links on merge
request page
[#6222] ticket:349 Fix commit links on merge request page
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/907a2338
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/907a2338
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/907a2338
Branch: refs/heads/master
Commit: 907a2338fee7c34de5427520dd1a0c23f9810a99
Parents: d65a489
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu May 9 10:08:12 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 16:05:13 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 3 +++
Allura/allura/templates/repo/merge_request.html | 2 +-
Allura/allura/templates/widgets/repo/log.html | 13 +++++++------
.../forgegit/tests/functional/test_controllers.py | 9 +++++++++
4 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/907a2338/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 59b154e..e444db7 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -331,7 +331,10 @@ class MergeRequestController(object):
c.thread = self.thread_widget
c.log_widget = self.log_widget
c.mr_dispose_form = self.mr_dispose_form
+ with self.req.push_downstream_context():
+ downstream_app = c.app
return dict(
+ downstream_app = downstream_app,
req=self.req,
page=page,
limit=limit,
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/907a2338/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 2ed40a9..820c4e9 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -40,7 +40,7 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
<div>{{g.markdown.convert(req.description)}}</div>
- {{ c.log_widget.display(value=req.commits) }}
+ {{ c.log_widget.display(value=req.commits, app=downstream_app) }}
<div class="grid-19"><a href="#discussion_holder">Discuss</a></div>
{% if h.has_access(c.app, 'write')() %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/907a2338/Allura/allura/templates/widgets/repo/log.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/log.html b/Allura/allura/templates/widgets/repo/log.html
index 7afac6c..61aadab 100644
--- a/Allura/allura/templates/widgets/repo/log.html
+++ b/Allura/allura/templates/widgets/repo/log.html
@@ -17,6 +17,7 @@
under the License.
-#}
{% from 'allura:templates/jinja_master/lib.html' import email_gravatar, abbr_date with context %}
+{% set app = app or c.app %}
<div>
{%if is_file%}
<div class="grid-19"><input type="button" value="Compare" class="compare_revision"></div>
@@ -37,10 +38,10 @@
{%if is_file%}
<div class="grid-1"><input type="checkbox" class="revision" revision="{{commit._id.split(':')[-1]}}" url_commit="{{commit.url()}}"></div>
{%endif%}
- <a href="{{c.app.repo.url_for_commit(commit)}}">{{commit.shorthand_id()}}</a>
- {% if c.app.repo.symbolics_for_commit(commit)[1] %}
- ({% for tag in c.app.repo.symbolics_for_commit(commit)[1] -%}
- <a href="{{c.app.repo.url_for_commit(tag)}}">{{tag}}</a>{% if not loop.last %} {% endif %}
+ <a href="{{app.repo.url_for_commit(commit)}}">{{commit.shorthand_id()}}</a>
+ {% if app.repo.symbolics_for_commit(commit)[1] %}
+ ({% for tag in app.repo.symbolics_for_commit(commit)[1] -%}
+ <a href="{{app.repo.url_for_commit(tag)}}">{{tag}}</a>{% if not loop.last %} {% endif %}
{%- endfor %})
{% endif %}
{%if is_file%}
@@ -62,7 +63,7 @@
{% if commit.committed.date %}{{commit.committed.date|datetimeformat}}{% endif %}
</td>
<td style="text-align: left; vertical-align: text-top">
- <a href="{{commit.url()}}tree{{request.params.get('path')}}">
+ <a href="{{commit.url()}}tree{{request.params.get('path', '')}}">
{%if is_file%}
View
{% else %}
@@ -71,7 +72,7 @@
</a>
{%if is_file%}
<br/>
- <a href="{{commit.url()}}tree{{request.params.get('path')}}?format=raw">Download</a>
+ <a href="{{commit.url()}}tree{{request.params.get('path', '')}}?format=raw">Download</a>
{%endif%}
</td>
</tr>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/907a2338/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index b9919aa..fc99a97 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -20,6 +20,7 @@ import re
import os
import shutil
+from nose.tools import assert_equal
import tg
import pkg_resources
from pylons import tmpl_context as c
@@ -357,6 +358,7 @@ class TestFork(_TestCase):
cloned.index.commit('Improve documentation')
cloned.remotes[0].push()
c.app.repo.refresh()
+ self.forked_repo = c.app.repo
def _follow(self, r, **kw):
if r.status_int == 302:
@@ -428,6 +430,13 @@ class TestFork(_TestCase):
r, mr_num = self._request_merge()
assert 'would like you to merge' in r, r.showbrowser()
assert 'Improve documentation' in r, r.showbrowser()
+ revs = r.html.findAll('tr', attrs={'class': 'rev'})
+ links = revs[0].findAll('a')
+ c_id = self.forked_repo.heads[0]['object_id']
+ assert_equal(links[0].get('href'), '/p/test2/code/ci/%s/' % c_id)
+ assert_equal(links[0].getText(), '[%s]' % c_id[:6])
+ assert_equal(links[1].get('href'), '/p/test2/code/ci/%s/tree' % c_id)
+ assert_equal(links[1].getText(), 'Tree')
def test_merge_request_list_view(self):
r, mr_num = self._request_merge()