Link to the documentation of package python-gerrit-api:
Code:
input_ = { "message": "New Commit message \n\nChange-Id: xxxxxxxxx\n" }
change = gerrit.changes.get('xxxxxxxxx')
result = change.set_commit_message(input_)
Error:
I get "gerrit.utils.exceptions.NotFoundError: 404 Client Error: Not Found" as error when I try to set a commit message using the above package.
This is the same issue as you asked in your other question. If you have a child parent project it will try to access the project as parent/child instead of parent%2Fchild. This will result in error 404
For a fix see the pull request. See: https://github.com/shijl0925/python-gerrit-api/pull/5
An example of a parent and child relation is the code-owners plugin at gerrit. The plugin repository does not contain any code, it is more like a folder that contains sub repositories and these child repositories normally will inherit the access rights from the parent.
If you look at the below url you can see that the url uses %2F and not the forward slash. That is what is not working in the gerrit-python-api
https://gerrit-review.googlesource.com/q/project:plugins%252Fcode-owners+status:open
This example works for me with the above pull request
input_ = {"message" : "New commit message\n\nChange-Id: I46554af336396ecb57d0c270c114a686439b5a66\n"}
c1 = gerrit.changes.get("12321")
print (c1)
c1.set_commit_message(input_)