下载gerrit 单子的一个commit:
mkdir workspace
cd workspace/
git init -q
git fetch ssh:gerrit_server/gerrit_repo_name commit_hash 注意git版本要高,比如2.21.0. git fetch没有输出,代表失败。
git checkout FETCH_HEAD
或者 git checkout FETCH_HEAD -- "filename*.txt"
命令行查询某个project的gerrit ticket,修改的文件列表包含Common/目录下的改动:
ssh -p 8282 gerrit_server gerrit query --format=JSON project:project_name status:open --patch-sets --files|grep "Common/"
Gerrit RESTAPI 查询某个project的gerrit ticket:
from pygerrit2 import GerritRestAPI
def query_gerrit():
rest = GerritRestAPI(url='https://gerrit.xxx.com/')
changes = rest.get(
"changes/?q=status:open+project:Robot&o=CURRENT_REVISION&o=ALL_FILES&o=DOWNLOAD_COMMANDS&