How can I list all comments posted in my changes to gerrit?

Here and there, a colleague leaves a comment about my code changes that I submit to gerrit. However, to see them, I must:

  • click on the change gerrit in the list of changes. This link does not even indicate what has been commented on.  image description
  • Then browse the list of files and click on any that is in the "Comments" column
     image description
  • I can then read the comment

It would be much better to see a list of code snippets that have comments sorted by time. That way, I would not have to click on my entire change history.

+4
source share
2 answers

REST .

1) , :

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

2) ( ) :

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

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
+2

, gerrit, , . , . no patchset 20. gerrit, , , . , Gerrit , - .

, gerrit api. Gerrit review.openstack.org:29418, :

ssh -p 29418 yourusername@review.openstack.org gerrit query --comments --current-patch-set <changeid>

<changeid> - Gerrit . , , . --current-patch-set --patch-sets, .

--json , JSON, , - script .

+1

Source: https://habr.com/ru/post/1667013/


All Articles