You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/01 23:10:59 UTC

[42/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/5fc04589
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5fc04589
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5fc04589

Branch: refs/heads/hss/7072
Commit: 5fc0458959a2041351292c65b2e3649bbe10efb0
Parents: 6d9c49d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 27 16:19:19 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Mar 30 19:20:42 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/5fc04589/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/5fc04589/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/5fc04589/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))