python-gerrit-cli


Namepython-gerrit-cli JSON
Version 1.0.6 PyPI version JSON
download
home_page
SummaryGerrit Command Line Interface
upload_time2023-07-10 14:30:14
maintainer
docs_urlNone
author
requires_python>=3.0
licenseThe MIT License (MIT) Copyright (c) 2023 Kai Peng, https://pkemb.com <pkemb@outlook.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords gerrit cli python
VCS
bugtrack_url
requirements prettytable python_gerrit_api Requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Gerrit 命令行接口。

![](https://img.shields.io/pypi/pyversions/python-gerrit-cli.svg)
![](https://img.shields.io/pypi/v/python-gerrit-cli.svg)
![LICENSE](https://img.shields.io/github/license/pkemb/python-gerrit-cli.svg)
![](https://static.pepy.tech/badge/python-gerrit-cli)

## 安装

```shell
pip install python-gerrit-cli
```

## 使用方法

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

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

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

### 示例1:查看帮助信息

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

```shell
$ 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:查询服务器版本

```shell
gerritcli version
```

### 示例3:查询修改

查询自己还没有合并的修改。默认以表格的形式输出。关于搜索指令`is:open+is:owner`的更多信息,可以参考gerrit文档,[Searching Changes](https://gerrit-review.googlesource.com/Documentation/user-search.html#_search_operators)。

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

### 示例4:指定输出格式

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

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

### 示例5:指定表头

`table`和`csv`格式默认只会打印`number`、`owner_name`、`subject`、`status`、`submitter_name`、`created`、`submitted`字段,`json`格式会打印所有字段。可以使用`--header`选项打印指定字段。例如只打印`number`和`subject`。支持的字段请参考`json`格式的输出。

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

### 示例6:列出所有的仓库

```shell
gerritcli project list
```

### 示例6:搜索活跃的账号

```shell
gerritcli account search 'is:active'
```

### 示例7:下载补丁

```shell
gerritcli patch <id>
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "python-gerrit-cli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": "Kai Peng <pkemb@outlook.com>",
    "keywords": "Gerrit,cli,Python",
    "author": "",
    "author_email": "Kai Peng <pkemb@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/9c/d2/ff04084168c139d46689db0b482c0b4f6351281cf0a3a946e9e86e825dd3/python-gerrit-cli-1.0.6.tar.gz",
    "platform": null,
    "description": "Gerrit \u547d\u4ee4\u884c\u63a5\u53e3\u3002\n\n![](https://img.shields.io/pypi/pyversions/python-gerrit-cli.svg)\n![](https://img.shields.io/pypi/v/python-gerrit-cli.svg)\n![LICENSE](https://img.shields.io/github/license/pkemb/python-gerrit-cli.svg)\n![](https://static.pepy.tech/badge/python-gerrit-cli)\n\n## \u5b89\u88c5\n\n```shell\npip install python-gerrit-cli\n```\n\n## \u4f7f\u7528\u65b9\u6cd5\n\n\u5728\u4f7f\u7528\u4e4b\u524d\u9700\u8981\u5148\u8bbe\u7f6e\u7528\u6237\u540d\u548cHTTP\u5bc6\u7801\uff0c\u8fd9\u4e9b\u4fe1\u606f\u5b58\u50a8\u5728`~/gerrit.rc`\u3002\u8fd9\u4e00\u6b65\u53ea\u9700\u8981\u505a\u4e00\u6b21\u3002\n\n```shell\ngerritcli server add <name> <host> <username> <password>\n```\n\n\u53ef\u4ee5\u6dfb\u52a0\u591a\u7ec4\u4fe1\u606f\uff08\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u6216\u540c\u4e00\u670d\u52a1\u5668\u7684\u4e0d\u540c\u7528\u6237\uff09\uff0c\u9ed8\u8ba4\u4f7f\u7528\u6dfb\u52a0\u7684\u7b2c\u4e00\u7ec4\u4fe1\u606f\u3002`gerritcli server default <name>`\u4fee\u6539\u9ed8\u8ba4\u503c\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5168\u5c40\u9009\u9879`-s <name>`\u6307\u5b9a\u670d\u52a1\u5668\u3002\n\n### \u793a\u4f8b1\uff1a\u67e5\u770b\u5e2e\u52a9\u4fe1\u606f\n\n\u4e3b\u547d\u4ee4\u548c\u5b50\u547d\u4ee4\u90fd\u652f\u6301`-h`\u9009\u9879\u3002\n\n```shell\n$ gerritcli -h\nusage: gerritcli [-h] [-s SERVER] [--debug] command ...\n\npositional arguments:\n  command     command usage\n    server    add/remove/list gerrit server info\n    version   show gerrit server version\n    project   project command\n    account   account command help\n    change    change command help\n    group     group command\n    patch     patch command help\n\noptional arguments:\n  -h, --help  show this help message and exit\n  -s SERVER   specify gerrit server. If not specified, the default value is used\n  --debug     enable debug\n\n$ gerritcli change -h\nusage: gerritcli change [-h] {search,get,create,delete} ...\n\npositional arguments:\n  {search,get,create,delete}\n                        change command help\n    search              Queries changes visible to the caller.\n    get                 get change\n    create              create change\n    delete              delete change\n\noptional arguments:\n  -h, --help            show this help message and exit\n```\n\n### \u793a\u4f8b2\uff1a\u67e5\u8be2\u670d\u52a1\u5668\u7248\u672c\n\n```shell\ngerritcli version\n```\n\n### \u793a\u4f8b3\uff1a\u67e5\u8be2\u4fee\u6539\n\n\u67e5\u8be2\u81ea\u5df1\u8fd8\u6ca1\u6709\u5408\u5e76\u7684\u4fee\u6539\u3002\u9ed8\u8ba4\u4ee5\u8868\u683c\u7684\u5f62\u5f0f\u8f93\u51fa\u3002\u5173\u4e8e\u641c\u7d22\u6307\u4ee4`is:open+is:owner`\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53ef\u4ee5\u53c2\u8003gerrit\u6587\u6863\uff0c[Searching Changes](https://gerrit-review.googlesource.com/Documentation/user-search.html#_search_operators)\u3002\n\n```shell\ngerritcli change search 'is:open+is:owner'\n```\n\n### \u793a\u4f8b4\uff1a\u6307\u5b9a\u8f93\u51fa\u683c\u5f0f\n\n\u4f7f\u7528\u9009\u9879`--format`\u6307\u5b9a\u8f93\u51fa\u7684\u683c\u5f0f\uff0c\u652f\u6301`table`\u3001`csv`\u3001`json`\u3002\u4f8b\u5982\u67e5\u8be2\u5206\u652f`xxxxx`\u5df2\u5408\u5e76\u7684\u4fee\u6539\uff0c\u5e76\u4fdd\u5b58\u5230\u6587\u4ef6\u3002\u8fd9\u6837\u53ef\u4ee5`Excel`\u7b49\u5de5\u5177\u6253\u5f00\uff0c\u8fdb\u884c\u4e8c\u6b21\u5206\u6790\u3002\n\n```shell\ngerritcli change search --format csv 'branch:xxxxx+is:merged' > merged_cl.csv\n```\n\n### \u793a\u4f8b5\uff1a\u6307\u5b9a\u8868\u5934\n\n`table`\u548c`csv`\u683c\u5f0f\u9ed8\u8ba4\u53ea\u4f1a\u6253\u5370`number`\u3001`owner_name`\u3001`subject`\u3001`status`\u3001`submitter_name`\u3001`created`\u3001`submitted`\u5b57\u6bb5\uff0c`json`\u683c\u5f0f\u4f1a\u6253\u5370\u6240\u6709\u5b57\u6bb5\u3002\u53ef\u4ee5\u4f7f\u7528`--header`\u9009\u9879\u6253\u5370\u6307\u5b9a\u5b57\u6bb5\u3002\u4f8b\u5982\u53ea\u6253\u5370`number`\u548c`subject`\u3002\u652f\u6301\u7684\u5b57\u6bb5\u8bf7\u53c2\u8003`json`\u683c\u5f0f\u7684\u8f93\u51fa\u3002\n\n```shell\ngerritcli change search 'is:open+is:owner' --header 'number,subject'\n```\n\n### \u793a\u4f8b6\uff1a\u5217\u51fa\u6240\u6709\u7684\u4ed3\u5e93\n\n```shell\ngerritcli project list\n```\n\n### \u793a\u4f8b6\uff1a\u641c\u7d22\u6d3b\u8dc3\u7684\u8d26\u53f7\n\n```shell\ngerritcli account search 'is:active'\n```\n\n### \u793a\u4f8b7\uff1a\u4e0b\u8f7d\u8865\u4e01\n\n```shell\ngerritcli patch <id>\n```\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)  Copyright (c) 2023 Kai Peng, https://pkemb.com <pkemb@outlook.com>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Gerrit Command Line Interface",
    "version": "1.0.6",
    "project_urls": {
        "Bug Reports": "https://github.com/pkemb/python-gerrit-cli/issues",
        "Funding": "https://github.com/pkemb/python-gerrit-cli",
        "Homepage": "https://github.com/pkemb/python-gerrit-cli",
        "Say Thanks!": "https://github.com/pkemb/python-gerrit-cli",
        "Source": "https://github.com/pkemb/python-gerrit-cli/"
    },
    "split_keywords": [
        "gerrit",
        "cli",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ee83ef93ad7e5aca00d9c851bf24283f9869c7aa4d3a907da9e347aebf5a8c5",
                "md5": "db5238b13609c89d124187e667f976ec",
                "sha256": "edad28eea66ebeeb17be8f603220e5877b8332ee7d4b83287e926301f2e1f690"
            },
            "downloads": -1,
            "filename": "python_gerrit_cli-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db5238b13609c89d124187e667f976ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 17606,
            "upload_time": "2023-07-10T14:30:12",
            "upload_time_iso_8601": "2023-07-10T14:30:12.674403Z",
            "url": "https://files.pythonhosted.org/packages/8e/e8/3ef93ad7e5aca00d9c851bf24283f9869c7aa4d3a907da9e347aebf5a8c5/python_gerrit_cli-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9cd2ff04084168c139d46689db0b482c0b4f6351281cf0a3a946e9e86e825dd3",
                "md5": "136a435d407a43d4dabc1627a3b38e17",
                "sha256": "7d5e9fa6ee890d76b22e14577eec538fdf9354eeaaee9fbaaf2de9fe2212b609"
            },
            "downloads": -1,
            "filename": "python-gerrit-cli-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "136a435d407a43d4dabc1627a3b38e17",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 16085,
            "upload_time": "2023-07-10T14:30:14",
            "upload_time_iso_8601": "2023-07-10T14:30:14.446976Z",
            "url": "https://files.pythonhosted.org/packages/9c/d2/ff04084168c139d46689db0b482c0b4f6351281cf0a3a946e9e86e825dd3/python-gerrit-cli-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 14:30:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pkemb",
    "github_project": "python-gerrit-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "prettytable",
            "specs": []
        },
        {
            "name": "python_gerrit_api",
            "specs": []
        },
        {
            "name": "Requests",
            "specs": []
        }
    ],
    "lcname": "python-gerrit-cli"
}
        
Elapsed time: 0.10085s