Problem viewing commit history via REST API

41 views
Skip to first unread message

Alexander Perham

unread,
Jun 27, 2017, 9:58:47 AM6/27/17
to Repo and Gerrit Discussion
Hi,
I'm trying to get the history log for a commit on Gerrit using https://github.com/uwolfer/gerrit-rest-java-client where it is listed as comments under the changes category.

I have tried this implementation:
GerritRestApi gerritClient = gerritRestApiFactory.create(..basicauth..));
ChangeApi change = gerritClient.changes().id(..id hash..);
RevisionApi revision = change.current();
Map<String, List<CommentInfo>> comments = revision.comments();
System.out.println(comments);
But it returns null. I find this weird since I'm able to access other variables such as what project it belongs to, branch, owner and so on.
Am I approaching this wrongly or is it it the Gerrit server itself that is "blocking access" to the data.

What can I do to solve this problem?

Edwin Kempin

unread,
Jun 27, 2017, 10:04:07 AM6/27/17
to Alexander Perham, Repo and Gerrit Discussion
On Tue, Jun 27, 2017 at 3:53 PM, Alexander Perham <zamp...@gmail.com> wrote:
Hi,
I'm trying to get the history log for a commit
Do you mean the change history?
 
on Gerrit using https://github.com/uwolfer/gerrit-rest-java-client where it is listed as comments under the changes category.

I have tried this implementation:
GerritRestApi gerritClient = gerritRestApiFactory.create(..basicauth..));
ChangeApi change = gerritClient.changes().id(..id hash..);
RevisionApi revision = change.current();
Map<String, List<CommentInfo>> comments = revision.comments();
This returns the inline comments of the current revision. Maybe there are none?
The change messages that form the change history are part of ChangeInfo which you can get from ChangeApi.get().
 
System.out.println(comments);
But it returns null. I find this weird since I'm able to access other variables such as what project it belongs to, branch, owner and so on.
Am I approaching this wrongly or is it it the Gerrit server itself that is "blocking access" to the data.

What can I do to solve this problem?

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Perham

unread,
Jun 28, 2017, 3:49:31 AM6/28/17
to Repo and Gerrit Discussion, zamp...@gmail.com


Den tisdag 27 juni 2017 kl. 16:04:07 UTC+2 skrev Edwin Kempin:

Do you mean the change history?
Yes, the change history for a specific commit. 
 
This returns the inline comments of the current revision. Maybe there are none?
The change messages that form the change history are part of ChangeInfo which you can get from ChangeApi.get(). 
In this particular case i know that there are comments in the change history but I can't access any of it.
I assumed that you could get the comments from specifying the revision that the change is currently in.
Is it possible to use ChangeApi.get() to get all the comments on the change in a list or map?
Reply all
Reply to author
Forward
Message has been deleted
0 new messages