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/05 11:35:38 UTC

[11/13] 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/c9497d84
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c9497d84
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c9497d84

Branch: refs/heads/ib/7837
Commit: c9497d848317fe90377cc4fe212c5ee31bb1d99f
Parents: 455293f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 3 13:46:16 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Mar 4 16:58:39 2015 +0000

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


http://git-wip-us.apache.org/repos/asf/allura/blob/c9497d84/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 420cc76..b588847 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -768,5 +768,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()