allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/5] allura git commit: [#7965] Remove logs endpoint and reintroduce commits endpoint. Update and fix RAML.
Date Fri, 20 May 2016 15:22:50 GMT
Repository: allura
Updated Branches:
  refs/heads/master d18fecbf5 -> 212c359bb


[#7965] Remove logs endpoint and reintroduce commits endpoint. Update and fix RAML.


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

Branch: refs/heads/master
Commit: 212c359bbcd99492b2bd74bc204c856ab8f769b8
Parents: 68f50e9
Author: Rohan Verma <rohanverma2004@gmail.com>
Authored: Fri May 20 01:25:38 2016 +0530
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Fri May 20 11:22:17 2016 -0400

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py | 36 +++-------------------------
 Allura/docs/api-rest/api.raml           | 23 +++++++-----------
 2 files changed, 12 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/212c359b/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 3d03d71..93c89a5 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -301,45 +301,15 @@ class RepoRestController(RepoRootController, AppRestControllerMixin):
         return dict(commit_count=len(all_commits))
 
     @expose('json:')
-    def logs(self, rev=None, comm=25, **kw):
+    def commits(self, rev=None, limit=25, **kw):
         '''
         Return 25 latest commits   : /rest/p/code/logs/ 
         Return 25 commits since sha: /rest/p/code/logs/e1a2ad
         Return 04 commits since sha: /rest/p/code/logs/e1a2ad/4
-        Return 120 latest commits  : /rest/p/code/logs/?comm=120
+        Return 120 latest commits  : /rest/p/code/logs/?limit=120
         '''
 
-        revisions = islice(c.app.repo.log(rev, id_only=False), int(comm))
-
-        return {
-            'commits': [
-                {
-                    'parents': [{'id': p} for p in commit['parents']],
-                    'url': c.app.repo.url_for_commit(commit['id']),
-                    'id': commit['id'],
-                    'message': commit['message'],
-                    'tree': commit.get('tree'),
-                    'committed_date': commit['committed']['date'],
-                    'authored_date': commit['authored']['date'],
-                    'author': {
-                        'name': commit['authored']['name'],
-                        'email': commit['authored']['email'],
-                    },
-                    'committer': {
-                        'name': commit['committed']['name'],
-                        'email': commit['committed']['email'],
-                    },
-                }
-                for commit in revisions
-            ]}
-
-    @expose('json:')
-    def commit(self, rev=None, **kw):
-        '''
-        Return the latest commit   : /rest/p/code/commit/ 
-        Return the commit with sha : /rest/p/code/commit/e1a2ad
-        '''
-        revisions = islice(c.app.repo.log(rev, id_only=False), 1)
+        revisions = islice(c.app.repo.log(rev, id_only=False), int(limit))
 
         return {
             'commits': [

http://git-wip-us.apache.org/repos/asf/allura/blob/212c359b/Allura/docs/api-rest/api.raml
----------------------------------------------------------------------
diff --git a/Allura/docs/api-rest/api.raml b/Allura/docs/api-rest/api.raml
index 623709a..3e95058 100755
--- a/Allura/docs/api-rest/api.raml
+++ b/Allura/docs/api-rest/api.raml
@@ -87,31 +87,26 @@ documentation:
               default: read
               enum: [read, admin, create, update]
 
-      /{scm_tool}
+      /{scm_tool}:
         description: |
           Represents the **Git/Hg/SVN tool** and returns the commit count.
 
         displayName: SCM Tool
         uriParameters:
-          displayName: Name of SCM Tool
-          type: string
-          example: git
+          scm_tool:
+            displayName: Name of SCM Tool
+            type: string
+            example: git
 
-        /logs:
+        /commits:
           description: |
             Returns the 25 latest commit logs of the SCM tool
           /{rev}:
             description: |
               Represents the revision ID of a commit from where you want the logs to start.
-            /{comm}:
-              Represents the number of commits you want to get from the log.
-
-        /commit:
-          description: |
-            Returns the details of the last commit
-          /{rev}:
-            description: |
-              Represents the revision ID of the specific commit you want
+            /{limit}:
+              description: |
+                Represents the number of commits you want to get from the log.
 
 
       /{wiki}:


Mime
View raw message