How do I list all comments posted on my changes in gerrit?

You could try to use REST to retrive this kind of info.

1) To list all open changes created by you:

curl -s --request GET --netrc https://GERRIT-SERVER/a/changes/?q=owner:self+AND+status:open | sed 1d | jq --raw-output ".[] | ._number"

2) To list all comments (and their dates) on a change:

curl -s --request GET --netrc https://GERRIT-SERVER/a/changes/CHANGE-NUMBER/comments | sed 1d | jq --raw-output ".[] | .[] | {Updated: .updated, Message: .message}"

Doing 1 + 2:

for c in $(curl -s --request GET --netrc https://GERRIT-SERVER/a/changes/?q=owner:self+AND+status:open | sed 1d | jq --raw-output ".[] | ._number")
do
    curl -s --request GET --netrc https://GERRIT-SERVER/a/changes/$c/comments | sed 1d | jq --raw-output ".[] | .[] | {Updated: .updated, Message: .message}"
done

It looks as if someone versions of gerrit, at least, will show you all the comments on the main review page. For example, take a look at this review. Look at the comments no patchset 20. In this gerrit instance, at least, all file comments will be listed here, along with links to he files and direct links to the individual comments. I don't know if this is stock Gerrit or if it has local modifications, but in the latter case they would be available publically somewhere.

You can get at the same information using the gerrit command line api. If your Gerrit host were review.openstack.org:29418, you could run:

ssh -p 29418 [email protected] gerrit query --comments --current-patch-set <changeid>

Where <changeid> is the Gerrit change-id or change number. This will show you all the comments, including inline comments from files, associated with the current patch set. You can replace --current-patch-set with --patch-sets to see this for all patch sets.

You can add --json to the query to get JSON output, which is useful if you would like to wrap this with some sort of script for pretty-fying the display.

Tags:

Git

Gerrit