from gerrit import GerritClient
gerrit = GerritClient(base_url="https://gerrit.xxx.xxx", username='xxx', password='xxxx')
change = gerrit.changes.get("7268")
print (change.branch)
print (change.project)
print (change.status)
# The current_revision is not returned when loading a change
print (change.current_revision)
resultset = gerrit.changes.search("q=7268&o=CURRENT_REVISION")
change = resultset[0]
# The current_revision is returned when searching
# and adding the CURRENT_REVISION option
print (change.current_revision)
# Use the current revision to display the files
revision = change.get_revision(change.current_revision)
for f in revision.files:
print (f)
这是我刚刚做的一个简单测试。看起来是个不错的api。谢谢,我可以自己用
见:https://python-gerrit-api.readthedocs.io/en/latest/_modules/gerrit/changes/change.html#GerritChange
相关问题 更多 >
编程相关推荐