You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/05/20 15:22:52 UTC
[3/5] allura git commit: [#7965] Added log endpoint and modified
commits endpoint
[#7965] Added log endpoint and modified commits endpoint
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/5083de90
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5083de90
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5083de90
Branch: refs/heads/master
Commit: 5083de90f6bff8dc233dc4537dffb77c55d6f933
Parents: d18fecb
Author: rhnvrm <ro...@gmail.com>
Authored: Fri Apr 15 03:28:43 2016 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri May 20 11:22:17 2016 -0400
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 36 +++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/5083de90/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 2f67783..e4627b0 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -301,8 +301,42 @@ class RepoRestController(RepoRootController, AppRestControllerMixin):
return dict(commit_count=len(all_commits))
@expose('json:')
+ def logs(self, rev=None, comm=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
+ '''
+
+ 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 commits(self, rev=None, **kw):
- revisions = islice(c.app.repo.log(rev, id_only=False), 25)
+
+ revisions = islice(c.app.repo.log(rev, id_only=False), 1)
return {
'commits': [