incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [1/2] git commit: [#7128] Added direct SCM implementation of commit_browser_data for SVN
Date Tue, 18 Feb 2014 21:39:19 GMT
Repository: incubator-allura
Updated Branches:
  refs/heads/cj/7128 [created] 33fa75608


[#7128] Added direct SCM implementation of commit_browser_data for SVN

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/cj/7128
Commit: 0b099be58173d16fcc46a710c95d197c948ec2a0
Parents: ef2fcae
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Tue Feb 18 19:54:03 2014 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Tue Feb 18 19:54:03 2014 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/svn_main.py | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0b099be5/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index dd72214..6e2ae00 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -25,6 +25,7 @@ from ming.orm.ormsession import ThreadLocalORMSession
 from tg import expose, redirect, validate, flash
 from tg.decorators import with_trailing_slash, without_trailing_slash
 from timermiddleware import Timer
+from paste.deploy.converters import asint
 
 # Pyforge-specific imports
 import allura.tasks.repo_tasks
@@ -71,7 +72,7 @@ class ForgeSVNApp(RepositoryApp):
         default_root = RepoRootController()
         self.root.refresh = default_root.refresh
         self.root.commit_browser = default_root.commit_browser
-        self.root.commit_browser_data = default_root.commit_browser_data
+        self.root.commit_browser_data = SVNCommitBrowserController().commit_browser_data
         self.root.status = default_root.status
         self.admin = SVNRepoAdminController(self)
 
@@ -178,6 +179,36 @@ class SVNImportController(BaseController):
         redirect(c.project.url() + 'admin/tools')
 
 
+class SVNCommitBrowserController(BaseController):
+
+    @without_trailing_slash
+    @expose('json:')
+    def commit_browser_data(self, start=None, limit=None, **kw):
+        data = {
+            'commits': [],
+            'next_column': 1,
+            'max_row': 0,
+            'built_tree': {},
+            'next_commit': None,
+        }
+        for i, commit in enumerate(c.app.repo.log(revs=start, id_only=False)):
+            if limit and i >= asint(limit):
+                data['next_commit'] = str(commit['id'])
+                break
+            data['commits'].append(str(commit['id']))
+            data['built_tree'][commit['id']] = {
+                'column': 0,
+                'parents': map(str, commit['parents']),
+                'short_id': '[%s]' % commit['id'],
+                'message': commit['message'],
+                'oid': str(commit['id']),
+                'row': i,
+                'url': c.app.repo.url_for_commit(commit['id']),
+            }
+        data['max_row'] = len(data['commits'])
+        return data
+
+
 def svn_timers():
     return Timer(
         'svn_lib.{method_name}', SM.svn.SVNLibWrapper, 'checkout', 'add',


Mime
View raw message