Skip to main content

Gerrit Command Line Interface

Project description

Gerrit 命令行接口。

LICENSE

安装

pip install python-gerrit-cli

使用方法

在使用之前需要先设置用户名和HTTP密码,这些信息存储在~/gerrit.rc。这一步只需要做一次。

gerritcli server add <name> <host> <username> <password>

可以添加多组信息(不同服务器,或同一服务器的不同用户),默认使用添加的第一组信息。gerritcli server default <name>修改默认值,也可以使用全局选项-s <name>指定服务器。

示例1:查看帮助信息

主命令和子命令都支持-h选项。

$ gerritcli -h
usage: gerritcli [-h] [-s SERVER] [--debug] command ...

positional arguments:
  command     command usage
    server    add/remove/list gerrit server info
    version   show gerrit server version
    project   project command
    account   account command help
    change    change command help
    group     group command
    patch     patch command help

optional arguments:
  -h, --help  show this help message and exit
  -s SERVER   specify gerrit server. If not specified, the default value is used
  --debug     enable debug

$ gerritcli change -h
usage: gerritcli change [-h] {search,get,create,delete} ...

positional arguments:
  {search,get,create,delete}
                        change command help
    search              Queries changes visible to the caller.
    get                 get change
    create              create change
    delete              delete change

optional arguments:
  -h, --help            show this help message and exit

示例2:查询服务器版本

gerritcli version

示例3:查询修改

查询自己还没有合并的修改。默认以表格的形式输出。关于搜索指令is:open+is:owner的更多信息,可以参考gerrit文档,Searching Changes

gerritcli change search 'is:open+is:owner'

示例4:指定输出格式

使用选项--format指定输出的格式,支持tablecsvjson。例如查询分支xxxxx已合并的修改,并保存到文件。这样可以Excel等工具打开,进行二次分析。

gerritcli change search --format csv 'branch:xxxxx+is:merged' > merged_cl.csv

示例5:指定表头

tablecsv格式默认只会打印numberowner_namesubjectstatussubmitter_namecreatedsubmitted字段,json格式会打印所有字段。可以使用--header选项打印指定字段。例如只打印numbersubject。支持的字段请参考json格式的输出。

gerritcli change search 'is:open+is:owner' --header 'number,subject'

示例6:列出所有的仓库

gerritcli project list

示例6:搜索活跃的账号

gerritcli account search 'is:active'

示例7:下载补丁

gerritcli patch <id>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-gerrit-cli-1.0.6.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

python_gerrit_cli-1.0.6-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file python-gerrit-cli-1.0.6.tar.gz.

File metadata

  • Download URL: python-gerrit-cli-1.0.6.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for python-gerrit-cli-1.0.6.tar.gz
Algorithm Hash digest
SHA256 7d5e9fa6ee890d76b22e14577eec538fdf9354eeaaee9fbaaf2de9fe2212b609
MD5 136a435d407a43d4dabc1627a3b38e17
BLAKE2b-256 9cd2ff04084168c139d46689db0b482c0b4f6351281cf0a3a946e9e86e825dd3

See more details on using hashes here.

File details

Details for the file python_gerrit_cli-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for python_gerrit_cli-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 edad28eea66ebeeb17be8f603220e5877b8332ee7d4b83287e926301f2e1f690
MD5 db5238b13609c89d124187e667f976ec
BLAKE2b-256 8ee83ef93ad7e5aca00d9c851bf24283f9869c7aa4d3a907da9e347aebf5a8c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page