rb-gateway post commit APIs
Review Request #6972 — Created Feb. 22, 2015 and submitted
This is to add support for the post commit UI that Review Board currently has. In order for Review Board Gateway hosted repositories to support this UI, rb-gateway must provide APIs for getting branches, getting commits, and getting an individual commit.
The URL for get branches is located at /branches and it requires a repository as the parameter. The returned JSON looks as follows:
[
{
"name": master,
"id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44"
}
]The URL for get commits is located at /commits and it requries a repository as the parameter, as well as the branch id. An optional start commit parameter can be provided to retrieve the commits beginning at the start commit. The returned JSON looks as follows:
[
{
"author": "John Doe",
"id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44",
"date": "2015-06-27T05:51:39-07:00",
"message": "Add README.md",
"parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6"
}
]The URL for get commit is located at /commit and it requries a repository as the parameter, as well as the commit id. The returned JSON looks as follows:
{
"author": "John Doe",
"id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44",
"date": "2015-06-27T05:51:39-07:00",
"message": "Add README.md",
"parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6",
"diff": "diff --git a/test b/test
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..044f599c9a720fe1a7d02e694a8dab492cbda8f0 100644
--- a/test
+++ b/test
@@ -1 +1,3 @@
test
+
+test"
}
The following are URLs ran through my browser and self rb-gateway, git repository test environment. I've listed the JSON that is returned.
http://localhost:8002/branches?repo=testrepo
[{"name":"im_a_branch","id":"83904e6acb60e7ec0dcaae6c09a579ab44d0cf38"},{"name":"master","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6"}]http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6
[{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944"}, ... ]http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6&start=fa1330719893098ae397356e8125c2aa45b49221
[{"author":"Jessica Yuen","id":"fa1330719893098ae397356e8125c2aa45b49221","date":"2015-02-12 16:01:48 -0700 -0700","message":"Removing all files in preparation for demo\n","parent_id":"9a3e0527e8decfabc12bbd9b75d0a683ef8320e2"}]For comparison,
git log
returns the following, notice that the start commit is omitted in the above request:
commit bfdde95432b3af879af969bd2377dc3e55ee46e6
Author: Jessica Yuen jyuen@ualberta.ca
Date: Fri Feb 13 22:34:01 2015 -0700Modified test
commit 304c53c163aedfd0c0e0933776f09c24b87f5944
Author: Jessica Yuen jyuen@ualberta.ca
Date: Fri Feb 13 22:32:42 2015 -0700Added .reviewboardrc
commit fa1330719893098ae397356e8125c2aa45b49221
Author: Jessica Yuen jyuen@ualberta.ca
Date: Thu Feb 12 16:01:48 2015 -0700Removing all files in preparation for demo
http://localhost:8002/commit?repo=testrepo&commit=304c53c163aedfd0c0e0933776f09c24b87f5944
{"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..044f599c9a720fe1a7d02e694a8dab492cbda8f0 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"}
Description | From | Last Updated |
---|---|---|
For get_commits, I don't think we'd want to include the diff, since it could end up being a huge amount … |
david | |
This isn't quite right. Because of the way the git frontend works, we want to use start if it's available, … |
david | |
We need to make sure that this includes full indexes. |
david | |
This should probably be in an else clause, right? |
david | |
This should probably be in an else clause, right? |
david | |
It would be nice to have better error codes here. If the commit isn't found, then this should return 404. … |
david | |
This should probably be in an else clause, right? |
david | |
Can we reformat this to put one item per line? gitCommit := GitCommit{ commit.Author().Name, commit.Id().String(), commit.Author().When.String(), commit.Message(), parent } |
david | |
Can we reformat this to put one item per line? gitCommit := GitCommit{ commit.Author().Name, commit.Id().String(), commit.Author().When.String(), commit.Message(), parent, diff } |
david | |
sorry again by why 10 branches? |
brennie | |
Is there any particular reason the maximum size is 20? Should this be a constant somewhere? |
brennie | |
Again, this probably should be a constant. |
brennie |
- Change Summary:
-
Added students group
- Groups:
- Change Summary:
-
Added API for getting all commits for a branch, I still need to support the option to specify a starting commit.
- Testing Done:
-
localhost:8002/branches?repo=testrepo returned the following JSON via my browser:
[{"name":"im_a_branch","id":"83904e6acb60e7ec0dcaae6c09a579ab44d0cf38"},{"name":"master","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6"}] + + http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6
+ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944"}, ... ] - Commit:
-
d5419213b4d9ba16de14f6851fb09a3e9e9d7657c96b137fca7c4fc9482ff73979d94f80425df2a9
- Diff:
-
Revision 2 (+219 -6)
-
Tool: PEP8 Style Checker Ignored Files: repository.go git_repository.go routes.go Tool: Pyflakes Ignored Files: repository.go git_repository.go routes.go
- Change Summary:
-
Added API for getting change, getting branches with a start commit. Think this is it for post commit APIs.
- Summary:
-
[WIP] rb-gateway post commit APIsrb-gateway post commit APIs
- Description:
-
This is to add support for the post commit UI that Review Board currently has. In order for Review Board Gateway hosted repositories to support this UI, rb-gateway must provide APIs for getting branches, getting commits, and getting change.
~ The URL for get branches is located at /branches and it requires a repository as the parameter. It will return a JSON containing the branch name and the branch id of all branches.
~ The URL for get branches is located at /branches and it requires a repository as the parameter. The returned JSON looks as follows:
+ [ + { + "name": master, + "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44" + } + ] + + The URL for get commits is located at /commits and it requries a repository as the parameter, as well as the branch id. An optional start commit parameter can be provided to retrieve the commits beginning at the start commit. The returned JSON looks as follows:
+ [ + { + "author": "John Doe", + "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", + "date": "2015-06-27T05:51:39-07:00", + "message": "Add README.md", + "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6", + "diff": "diff --git a/test b/test + index 9daeafb..dced80a 100644 + --- a/test + +++ b/test + @@ -1 +1,3 @@ + test + + + +test" + } + ] + + The URL for get change is located at /change and it requries a repository as the parameter, as well as the commit id. The returned JSON looks the same as get commits, however, instead of a JSON array, only a single commit is returned.
- Testing Done:
-
~ localhost:8002/branches?repo=testrepo returned the following JSON via my browser:
~ The following are URLs ran through my browser and self rb-gateway, git repository test environment. I've listed the JSON that is returned.
+ + http://localhost:8002/branches?repo=testrepo
[{"name":"im_a_branch","id":"83904e6acb60e7ec0dcaae6c09a579ab44d0cf38"},{"name":"master","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6"}] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6
~ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944"}, ... ] ~ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944","diff":"diff --git a/test b/test\nindex 9daeafb..dced80a 100644\n--- a/test\n+++ b/test\n@@ -1 +1,3 @@\n test\n+\n+test\n"}, ... ] + + http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6&start=fa1330719893098ae397356e8125c2aa45b49221
+ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944","diff":"diff --git a/test b/test\nindex 9daeafb..dced80a 100644\n--- a/test\n+++ b/test\n@@ -1 +1,3 @@\n test\n+\n+test\n"},{"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29..044f599 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"}] + + For comparison,
git log
returns the following, notice that the start commit is omitted in the above request:+ commit bfdde95432b3af879af969bd2377dc3e55ee46e6 + Author: Jessica Yuen jyuen@ualberta.ca + Date: Fri Feb 13 22:34:01 2015 -0700 + + Modified test
+ + + commit 304c53c163aedfd0c0e0933776f09c24b87f5944
+ Author: Jessica Yuen jyuen@ualberta.ca + Date: Fri Feb 13 22:32:42 2015 -0700 + + Added .reviewboardrc
+ + + commit fa1330719893098ae397356e8125c2aa45b49221
+ Author: Jessica Yuen jyuen@ualberta.ca + Date: Thu Feb 12 16:01:48 2015 -0700 + + Removing all files in preparation for demo
+ + + http://localhost:8002/change?repo=testrepo&commit=304c53c163aedfd0c0e0933776f09c24b87f5944
+ {"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29..044f599 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"} - Commit:
-
c96b137fca7c4fc9482ff73979d94f80425df2a9195448e29e12be57c5bfef56f02dfa26690b8aa5
- Diff:
-
Revision 3 (+376 -5)
-
Tool: PEP8 Style Checker Ignored Files: repository.go git_repository.go routes.go Tool: Pyflakes Ignored Files: repository.go git_repository.go routes.go
-
-
For get_commits, I don't think we'd want to include the diff, since it could end up being a huge amount of data to transmit every time /r/new/ is opened up.
-
This isn't quite right. Because of the way the git frontend works, we want to use
start
if it's available, andbranch
if it's not. This should basically be the result ofgit log start
. Of note is thatstart
is the latest commit to log, and we go back in history from there. Subsequent calls will use theI think what we want to do is something like this:
if len(start) != 0 { revWalk.PushHead(start) } else { revWalk.PushHead(branch) }
We'd then list out one "page" of commits (probably 30?) and return that.
-
- Change Summary:
-
Fixing some issues, still need to address one but submitting for weekly status report.
- Description:
-
This is to add support for the post commit UI that Review Board currently has. In order for Review Board Gateway hosted repositories to support this UI, rb-gateway must provide APIs for getting branches, getting commits, and getting change.
The URL for get branches is located at /branches and it requires a repository as the parameter. The returned JSON looks as follows:
[ { "name": master, "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44" } ] The URL for get commits is located at /commits and it requries a repository as the parameter, as well as the branch id. An optional start commit parameter can be provided to retrieve the commits beginning at the start commit. The returned JSON looks as follows:
[ { "author": "John Doe", "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", "date": "2015-06-27T05:51:39-07:00", "message": "Add README.md", + "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6" + } + ] + + The URL for get change is located at /change and it requries a repository as the parameter, as well as the commit id. The returned JSON looks as follows:
+ { + "author": "John Doe", + "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", + "date": "2015-06-27T05:51:39-07:00", + "message": "Add README.md", "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6", "diff": "diff --git a/test b/test index 9daeafb..dced80a 100644 --- a/test +++ b/test @@ -1 +1,3 @@ test + +test" ~ } ~ } - ] - - The URL for get change is located at /change and it requries a repository as the parameter, as well as the commit id. The returned JSON looks the same as get commits, however, instead of a JSON array, only a single commit is returned.
- Testing Done:
-
The following are URLs ran through my browser and self rb-gateway, git repository test environment. I've listed the JSON that is returned.
http://localhost:8002/branches?repo=testrepo
[{"name":"im_a_branch","id":"83904e6acb60e7ec0dcaae6c09a579ab44d0cf38"},{"name":"master","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6"}] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6
~ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944","diff":"diff --git a/test b/test\nindex 9daeafb..dced80a 100644\n--- a/test\n+++ b/test\n@@ -1 +1,3 @@\n test\n+\n+test\n"}, ... ] ~ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944"}, ... ] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6&start=fa1330719893098ae397356e8125c2aa45b49221
~ [{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944","diff":"diff --git a/test b/test\nindex 9daeafb..dced80a 100644\n--- a/test\n+++ b/test\n@@ -1 +1,3 @@\n test\n+\n+test\n"},{"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29..044f599 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"}] ~ [{"author":"Jessica Yuen","id":"fa1330719893098ae397356e8125c2aa45b49221","date":"2015-02-12 16:01:48 -0700 -0700","message":"Removing all files in preparation for demo\n","parent_id":"9a3e0527e8decfabc12bbd9b75d0a683ef8320e2"}] For comparison,
git log
returns the following, notice that the start commit is omitted in the above request:commit bfdde95432b3af879af969bd2377dc3e55ee46e6 Author: Jessica Yuen jyuen@ualberta.ca Date: Fri Feb 13 22:34:01 2015 -0700 Modified test
commit 304c53c163aedfd0c0e0933776f09c24b87f5944
Author: Jessica Yuen jyuen@ualberta.ca Date: Fri Feb 13 22:32:42 2015 -0700 Added .reviewboardrc
commit fa1330719893098ae397356e8125c2aa45b49221
Author: Jessica Yuen jyuen@ualberta.ca Date: Thu Feb 12 16:01:48 2015 -0700 Removing all files in preparation for demo
http://localhost:8002/change?repo=testrepo&commit=304c53c163aedfd0c0e0933776f09c24b87f5944
{"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29..044f599 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"} - Commit:
-
195448e29e12be57c5bfef56f02dfa26690b8aa5cfe2b3639f66ce9a669a229e6add7bac25eed898
- Diff:
-
Revision 4 (+367 -5)
-
Tool: PEP8 Style Checker Ignored Files: repository.go git_repository.go routes.go Tool: Pyflakes Ignored Files: repository.go git_repository.go routes.go
- Change Summary:
-
Addressing remaining issues above.
- Description:
-
This is to add support for the post commit UI that Review Board currently has. In order for Review Board Gateway hosted repositories to support this UI, rb-gateway must provide APIs for getting branches, getting commits, and getting change.
The URL for get branches is located at /branches and it requires a repository as the parameter. The returned JSON looks as follows:
[ { "name": master, "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44" } ] The URL for get commits is located at /commits and it requries a repository as the parameter, as well as the branch id. An optional start commit parameter can be provided to retrieve the commits beginning at the start commit. The returned JSON looks as follows:
[ { "author": "John Doe", "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", "date": "2015-06-27T05:51:39-07:00", "message": "Add README.md", "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6" } ] The URL for get change is located at /change and it requries a repository as the parameter, as well as the commit id. The returned JSON looks as follows:
{ "author": "John Doe", "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", "date": "2015-06-27T05:51:39-07:00", "message": "Add README.md", "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6", "diff": "diff --git a/test b/test ~ index 9daeafb..dced80a 100644 ~ index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..044f599c9a720fe1a7d02e694a8dab492cbda8f0 100644 --- a/test +++ b/test @@ -1 +1,3 @@ test + +test" } - Testing Done:
-
The following are URLs ran through my browser and self rb-gateway, git repository test environment. I've listed the JSON that is returned.
http://localhost:8002/branches?repo=testrepo
[{"name":"im_a_branch","id":"83904e6acb60e7ec0dcaae6c09a579ab44d0cf38"},{"name":"master","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6"}] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6
[{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944"}, ... ] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6&start=fa1330719893098ae397356e8125c2aa45b49221
[{"author":"Jessica Yuen","id":"fa1330719893098ae397356e8125c2aa45b49221","date":"2015-02-12 16:01:48 -0700 -0700","message":"Removing all files in preparation for demo\n","parent_id":"9a3e0527e8decfabc12bbd9b75d0a683ef8320e2"}] For comparison,
git log
returns the following, notice that the start commit is omitted in the above request:commit bfdde95432b3af879af969bd2377dc3e55ee46e6 Author: Jessica Yuen jyuen@ualberta.ca Date: Fri Feb 13 22:34:01 2015 -0700 Modified test
commit 304c53c163aedfd0c0e0933776f09c24b87f5944
Author: Jessica Yuen jyuen@ualberta.ca Date: Fri Feb 13 22:32:42 2015 -0700 Added .reviewboardrc
commit fa1330719893098ae397356e8125c2aa45b49221
Author: Jessica Yuen jyuen@ualberta.ca Date: Thu Feb 12 16:01:48 2015 -0700 Removing all files in preparation for demo
http://localhost:8002/change?repo=testrepo&commit=304c53c163aedfd0c0e0933776f09c24b87f5944
~ {"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29..044f599 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"} ~ {"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..044f599c9a720fe1a7d02e694a8dab492cbda8f0 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"} - Commit:
-
cfe2b3639f66ce9a669a229e6add7bac25eed89807319e533007fe91dba10e623a39e0eca73bf78b
- Diff:
-
Revision 5 (+381 -5)
-
Tool: PEP8 Style Checker Ignored Files: repository.go git_repository.go routes.go Tool: Pyflakes Ignored Files: repository.go git_repository.go routes.go
- Change Summary:
-
Addressing issues and renamed getChange to getCommit.
- Description:
-
~ This is to add support for the post commit UI that Review Board currently has. In order for Review Board Gateway hosted repositories to support this UI, rb-gateway must provide APIs for getting branches, getting commits, and getting change.
~ This is to add support for the post commit UI that Review Board currently has. In order for Review Board Gateway hosted repositories to support this UI, rb-gateway must provide APIs for getting branches, getting commits, and getting an individual commit.
The URL for get branches is located at /branches and it requires a repository as the parameter. The returned JSON looks as follows:
[ { "name": master, "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44" } ] The URL for get commits is located at /commits and it requries a repository as the parameter, as well as the branch id. An optional start commit parameter can be provided to retrieve the commits beginning at the start commit. The returned JSON looks as follows:
[ { "author": "John Doe", "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", "date": "2015-06-27T05:51:39-07:00", "message": "Add README.md", "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6" } ] ~ The URL for get change is located at /change and it requries a repository as the parameter, as well as the commit id. The returned JSON looks as follows:
~ The URL for get commit is located at /commit and it requries a repository as the parameter, as well as the commit id. The returned JSON looks as follows:
{ "author": "John Doe", "id": "1b6f00c0fe975dd12251431ed2ea561e0acc6d44", "date": "2015-06-27T05:51:39-07:00", "message": "Add README.md", "parent_id": "bfdde95432b3af879af969bd2377dc3e55ee46e6", "diff": "diff --git a/test b/test index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..044f599c9a720fe1a7d02e694a8dab492cbda8f0 100644 --- a/test +++ b/test @@ -1 +1,3 @@ test + +test" } - Testing Done:
-
The following are URLs ran through my browser and self rb-gateway, git repository test environment. I've listed the JSON that is returned.
http://localhost:8002/branches?repo=testrepo
[{"name":"im_a_branch","id":"83904e6acb60e7ec0dcaae6c09a579ab44d0cf38"},{"name":"master","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6"}] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6
[{"author":"Jessica Yuen","id":"bfdde95432b3af879af969bd2377dc3e55ee46e6","date":"2015-02-13 22:34:01 -0700 -0700","message":"Modified test\n","parent_id":"304c53c163aedfd0c0e0933776f09c24b87f5944"}, ... ] http://localhost:8002/commits?repo=testrepo&branch=bfdde95432b3af879af969bd2377dc3e55ee46e6&start=fa1330719893098ae397356e8125c2aa45b49221
[{"author":"Jessica Yuen","id":"fa1330719893098ae397356e8125c2aa45b49221","date":"2015-02-12 16:01:48 -0700 -0700","message":"Removing all files in preparation for demo\n","parent_id":"9a3e0527e8decfabc12bbd9b75d0a683ef8320e2"}] For comparison,
git log
returns the following, notice that the start commit is omitted in the above request:commit bfdde95432b3af879af969bd2377dc3e55ee46e6 Author: Jessica Yuen jyuen@ualberta.ca Date: Fri Feb 13 22:34:01 2015 -0700 Modified test
commit 304c53c163aedfd0c0e0933776f09c24b87f5944
Author: Jessica Yuen jyuen@ualberta.ca Date: Fri Feb 13 22:32:42 2015 -0700 Added .reviewboardrc
commit fa1330719893098ae397356e8125c2aa45b49221
Author: Jessica Yuen jyuen@ualberta.ca Date: Thu Feb 12 16:01:48 2015 -0700 Removing all files in preparation for demo
~ http://localhost:8002/change?repo=testrepo&commit=304c53c163aedfd0c0e0933776f09c24b87f5944
~ http://localhost:8002/commit?repo=testrepo&commit=304c53c163aedfd0c0e0933776f09c24b87f5944
{"author":"Jessica Yuen","id":"304c53c163aedfd0c0e0933776f09c24b87f5944","date":"2015-02-13 22:32:42 -0700 -0700","message":"Added .reviewboardrc\n","parent_id":"fa1330719893098ae397356e8125c2aa45b49221","diff":"diff --git a/.reviewboardrc b/.reviewboardrc\nindex e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..044f599c9a720fe1a7d02e694a8dab492cbda8f0 100644\n--- a/.reviewboardrc\n+++ b/.reviewboardrc\n@@ -0,0 +1,2 @@\n+REVIEWBOARD_URL = 'http://localhost:8080/'\n+REPOSITORY = 'test-repo1'\n"} - Commit:
-
07319e533007fe91dba10e623a39e0eca73bf78bf2f6a945340ee865180bf4f5538c0e6189117a6e
- Diff:
-
Revision 6 (+391 -5)
-
Tool: PEP8 Style Checker Ignored Files: repository.go git_repository.go routes.go Tool: Pyflakes Ignored Files: repository.go git_repository.go routes.go
-
-
Can we reformat this to put one item per line?
gitCommit := GitCommit{ commit.Author().Name, commit.Id().String(), commit.Author().When.String(), commit.Message(), parent }
-
Can we reformat this to put one item per line?
gitCommit := GitCommit{ commit.Author().Name, commit.Id().String(), commit.Author().When.String(), commit.Message(), parent, diff }
- Change Summary:
-
Adding support for getting commits by branch name (since RB uses branch name instead of branch sha for look up) + fixing David's suggestion.
- Commit:
-
f2f6a945340ee865180bf4f5538c0e6189117a6e1de4d8e1f02a3846653fc607cbec213aa377091d
- Diff:
-
Revision 7 (+408 -5)
-
Tool: PEP8 Style Checker Ignored Files: repository.go git_repository.go routes.go Tool: Pyflakes Ignored Files: repository.go git_repository.go routes.go
- Change Summary:
-
Constants for page size, initial allocation, patch index length
- Commit:
-
1de4d8e1f02a3846653fc607cbec213aa377091ddb50a0903de00477691048679e124f2f1cea3b65
- Diff:
-
Revision 8 (+414 -5)