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/03/30 14:26:59 UTC
[43/45] allura git commit: [#7837] ticket:750 Handle copied in svn
[#7837] ticket:750 Handle copied in svn
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fd8cd231
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fd8cd231
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fd8cd231
Branch: refs/heads/ib/7837
Commit: fd8cd2318ab0209767c200ed8f849a2fa788588a
Parents: 2bc9a71
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 27 16:19:19 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Mar 27 16:21:17 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/repository.py | 5 ++++-
Allura/allura/templates/repo/commit.html | 2 +-
ForgeSVN/forgesvn/model/svn.py | 17 +++++++++++++++--
3 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/fd8cd231/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index fb9a04e..edebeb4 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -1107,7 +1107,10 @@ class Commit(RepoObject, ActivityObject):
def paged_diffs(self, start=0, end=None):
diffs = self.repo.paged_diffs(self._id, start, end)
- diffs['copied'] = self._diffs_copied(diffs['added'], diffs['removed'])
+ if not diffs.get('copied'):
+ diffs['copied'] = []
+ copied = self._diffs_copied(diffs['added'], diffs['removed'])
+ diffs['copied'].extend(copied)
return Object(
added=diffs['added'],
removed=diffs['removed'],
http://git-wip-us.apache.org/repos/asf/allura/blob/fd8cd231/Allura/allura/templates/repo/commit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/commit.html b/Allura/allura/templates/repo/commit.html
index 9c6342f..98afbba 100644
--- a/Allura/allura/templates/repo/commit.html
+++ b/Allura/allura/templates/repo/commit.html
@@ -148,7 +148,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
<span class="empty-diff">File was removed.</span>
{% elif type == 'copied' %}
{% if file.ratio == 1 %}
- <span class="empty-diff">File was renamed.</span>
+ <span class="empty-diff">File was copied or renamed.</span>
{% else %}
{{g.highlight(file.diff, lexer='diff')}}
{% endif %}
http://git-wip-us.apache.org/repos/asf/allura/blob/fd8cd231/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index f37c1e2..cf70b7d 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -781,7 +781,13 @@ class SVNImplementation(M.RepositoryImplementation):
return []
def paged_diffs(self, commit_id, start=0, end=None):
- result = {'added': [], 'removed': [], 'changed': [], 'total': 0}
+ result = {
+ 'added': [],
+ 'removed': [],
+ 'changed': [],
+ 'copied': [],
+ 'total': 0,
+ }
rev = self._revision(commit_id)
try:
log_info = self._svn.log(
@@ -798,7 +804,14 @@ class SVNImplementation(M.RepositoryImplementation):
paths = log_info[0].changed_paths
result['total'] = len(paths)
for p in paths[start:end]:
- if p['action'] == 'A':
+ if p['copyfrom_path'] is not None:
+ result['copied'].append({
+ 'new': h.really_unicode(p.path),
+ 'old': h.really_unicode(p.copyfrom_path),
+ 'ratio': 1,
+ 'diff': '',
+ })
+ elif p['action'] == 'A':
result['added'].append(h.really_unicode(p.path))
elif p['action'] == 'D':
result['removed'].append(h.really_unicode(p.path))