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:54 UTC

[38/45] allura git commit: [#7837] ticket:738 Implement paged_diffs for SVN

[#7837] ticket:738 Implement paged_diffs for SVN


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/346db71c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/346db71c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/346db71c

Branch: refs/heads/ib/7837
Commit: 346db71cac5f21aeb59b6d9d396592364f05f8d8
Parents: 8b99fdc
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 3 13:46:16 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Mar 27 15:13:07 2015 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/model/svn.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/346db71c/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 142ca6a..c033f44 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -780,5 +780,29 @@ class SVNImplementation(M.RepositoryImplementation):
     def tags(self):
         return []
 
+    def paged_diffs(self, commit_id, start=0, end=None):
+        added, removed, changed, total = [], [], [], 0
+        rev = self._revision(commit_id)
+        prev_rev = self._revision(self._oid(rev.number - 1))
+        summary = self._svn.diff_summarize(
+            self._url,
+            prev_rev,
+            self._url,
+            rev)
+        total = len(summary)
+        for s in summary:
+            if s.summarize_kind == pysvn.diff_summarize_kind.added:
+                added.append(h.really_unicode(s.path))
+            elif s.summarize_kind == pysvn.diff_summarize_kind.delete:
+                removed.append(h.really_unicode(s.path))
+            elif s.summarize_kind == pysvn.diff_summarize_kind.modified:
+                changed.append(h.really_unicode(s.path))
+        return {
+            'added': added,
+            'removed': removed,
+            'changed': changed,
+            'total': total,
+        }
+
 
 Mapper.compile_all()