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:45 UTC
[1/4] git commit: [#6222] Minor bug fix and test cleanup
Updated Branches:
refs/heads/master f3b0767c0 -> 2251ba045
[#6222] Minor bug fix and test cleanup
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2251ba04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2251ba04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2251ba04
Branch: refs/heads/master
Commit: 2251ba045b793225495d0daf45898397d263b7f6
Parents: 907a233
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri May 10 15:51:19 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 16:05:13 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 2 +-
.../forgegit/tests/functional/test_controllers.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2251ba04/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index e351cc5..a9d16c0 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -335,7 +335,7 @@ class GitImplementation(M.RepositoryImplementation):
try:
containing_branches = self._git.git.branch(contains=commit._id)
except git.GitCommandError:
- return []
+ return [], tags
containing_branches = [br.strip(' *') for br in containing_branches.split('\n')]
return containing_branches, tags
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2251ba04/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 fc99a97..e1efee9 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -19,6 +19,7 @@ import json
import re
import os
import shutil
+import tempfile
from nose.tools import assert_equal
import tg
@@ -348,9 +349,7 @@ class TestFork(_TestCase):
cloned_from.full_fs_path)
# Add commit to a forked repo, thus merge requests will not be empty
# clone repo to tmp location first (can't add commit to bare repos directly)
- clone_path = '/tmp/test2-code-clone'
- if os.path.exists(clone_path):
- shutil.rmtree(clone_path)
+ clone_path = tempfile.mkdtemp()
cloned = c.app.repo._impl._git.clone(clone_path)
with open(clone_path + '/README', 'w+') as f:
f.write('Very useful README')
@@ -359,6 +358,7 @@ class TestFork(_TestCase):
cloned.remotes[0].push()
c.app.repo.refresh()
self.forked_repo = c.app.repo
+ shutil.rmtree(clone_path, ignore_errors=True)
def _follow(self, r, **kw):
if r.status_int == 302:
[3/4] git commit: [#6222] ticket:349 Fix commit links on merge
request page
Posted by jo...@apache.org.
[#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()
[2/4] git commit: [#6222] ticket:349 Handle git errors gracefully in
symbolics_for_commit
Posted by jo...@apache.org.
[#6222] ticket:349 Handle git errors gracefully in symbolics_for_commit
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d65a4892
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d65a4892
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d65a4892
Branch: refs/heads/master
Commit: d65a4892334f5b3b2bf70ac92d4e45e7eef49586
Parents: 6db9bdf
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu May 9 08:55:57 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 16:05:13 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d65a4892/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 2511ce0..e351cc5 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -332,7 +332,10 @@ class GitImplementation(M.RepositoryImplementation):
def symbolics_for_commit(self, commit):
branch_heads, tags = super(self.__class__, self).symbolics_for_commit(commit)
- containing_branches = self._git.git.branch(contains=commit._id)
+ try:
+ containing_branches = self._git.git.branch(contains=commit._id)
+ except git.GitCommandError:
+ return []
containing_branches = [br.strip(' *') for br in containing_branches.split('\n')]
return containing_branches, tags
[4/4] git commit: [#6222] ticket:349 Better tests for merge request
Posted by jo...@apache.org.
[#6222] ticket:349 Better tests for merge request
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6db9bdf1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6db9bdf1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6db9bdf1
Branch: refs/heads/master
Commit: 6db9bdf1d8f064699b3c33084a5e37393e5fddc5
Parents: f3b0767
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu May 9 08:38:03 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 16:05:13 2013 +0000
----------------------------------------------------------------------
.../forgegit/tests/functional/test_controllers.py | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6db9bdf1/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 d5c8365..b9919aa 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -17,6 +17,8 @@
import json
import re
+import os
+import shutil
import tg
import pkg_resources
@@ -343,6 +345,18 @@ class TestFork(_TestCase):
cloned_from.full_fs_path,
cloned_from.app.config.script_name(),
cloned_from.full_fs_path)
+ # Add commit to a forked repo, thus merge requests will not be empty
+ # clone repo to tmp location first (can't add commit to bare repos directly)
+ clone_path = '/tmp/test2-code-clone'
+ if os.path.exists(clone_path):
+ shutil.rmtree(clone_path)
+ cloned = c.app.repo._impl._git.clone(clone_path)
+ with open(clone_path + '/README', 'w+') as f:
+ f.write('Very useful README')
+ cloned.index.add(['README'])
+ cloned.index.commit('Improve documentation')
+ cloned.remotes[0].push()
+ c.app.repo.refresh()
def _follow(self, r, **kw):
if r.status_int == 302:
@@ -413,6 +427,7 @@ class TestFork(_TestCase):
def test_merge_request_detail_view(self):
r, mr_num = self._request_merge()
assert 'would like you to merge' in r, r.showbrowser()
+ assert 'Improve documentation' in r, r.showbrowser()
def test_merge_request_list_view(self):
r, mr_num = self._request_merge()