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/10/02 18:29:46 UTC
[2/7] git commit: [#5775] ticket:433 set the old rev for copied from
link
[#5775] ticket:433 set the old rev for copied from link
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/7ed43a97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/7ed43a97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/7ed43a97
Branch: refs/heads/master
Commit: 7ed43a970c6455f20c24d0103e64c1c1350749ab
Parents: b96a011
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Tue Oct 1 03:33:23 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Oct 2 15:40:30 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/widgets/repo/log.html | 8 ++++++--
ForgeGit/forgegit/model/git_repo.py | 6 ++----
ForgeGit/forgegit/tests/model/test_repository.py | 4 ++--
3 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7ed43a97/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 ec6b048..f526a07 100644
--- a/Allura/allura/templates/widgets/repo/log.html
+++ b/Allura/allura/templates/widgets/repo/log.html
@@ -18,6 +18,7 @@
-#}
{% from 'allura:templates/jinja_master/lib.html' import user_link, abbr_date with context %}
{% set app = app or c.app %}
+{% set path = request.params.get('path', '')%}
<div>
{%if is_file%}
<div class="grid-19"><input type="button" value="Compare" class="compare_revision"></div>
@@ -68,13 +69,16 @@
{% if commit.committed.date %}{{commit.committed.date|datetimeformat}}{% endif %}
</td>
<td style="text-align: left; vertical-align: text-top">
- <a class="browse" href="{{app.repo.url_for_commit(commit.id)}}tree{{request.params.get('path', '')}}">
+ <a class="browse" href="{{app.repo.url_for_commit(commit.id)}}tree{{path}}">
{{ 'View' if is_file else 'Tree' }}
</a>
{%if is_file%}
<br/>
- <a class="download" href="{{app.repo.url_for_commit(commit.id)}}tree{{request.params.get('path', '')}}?format=raw">Download</a>
+ <a class="download" href="{{app.repo.url_for_commit(commit.id)}}tree{{path}}?format=raw">Download</a>
{%endif%}
+ {% if commit.rename_details %}
+ {%set path=commit.rename_details['path']%}
+ {% endif %}
</td>
</tr>
{% endfor %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7ed43a97/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 955c9b3..cb16763 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -313,8 +313,9 @@ class GitImplementation(M.RepositoryImplementation):
if path:
if renamed and renamed['to'] == path:
rename_details['path'] = '/' + renamed['from']
+ revisions = [revision for revision in self._git.iter_commits(revs, renamed['from'])]
rename_details['commit_url'] = self._repo.url_for_commit(
- ci.hexsha
+ revisions[1].hexsha
)
try:
@@ -340,9 +341,6 @@ class GitImplementation(M.RepositoryImplementation):
'size': size,
'rename_details': rename_details,
}
- if rename_details:
- # we do not need to show commits before rename
- break
def _iter_commits_with_refs(self, *args, **kwargs):
"""
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7ed43a97/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 575ccba..365060d 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -568,12 +568,12 @@ class TestGitRename(unittest.TestCase):
def test_renamed_file(self):
# There was a file f.txt, then it was renamed to f2.txt.
commits = list(self.repo.log(id_only=False, path='/f2.txt'))
- self.assertEqual(len(commits), 2)
+ self.assertEqual(len(commits), 4)
rename_commit = commits[1]
self.assertEqual(rename_commit['rename_details']['path'], '/f.txt')
self.assertEqual(
rename_commit['rename_details']['commit_url'],
- self.repo.url_for_commit(rename_commit['id'])
+ '/p/test/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/'
)
def test_merge_commit(self):