Skip to main content

A tool help you cherry pick patches from gerrit server

Project description

Pypi version Build Status Python Compatibility GitHub code size in bytes GitHub

pick-patch

Help you cherry pick patches from Gerrit server

pick-patch-demo-optimize

Installation

pip install pick-patch

Configuration

  1. Get user name and http password in gerrit setting webpage (ex. https://review.gerrithub.io/settings/#HTTPCredentials)
  2. Add user name and http password in ~/.netrc (ex. machine review.gerrithub.io login susu9 password XXXOOOXXXOO)
  3. Now you are good to go. (script parses ~/.netrc by default)

Custimization

You can create a config file in ~/.pickrc to customize your preference

# Supported configurations and format
repo = repo
user = susu9
password = XXXOOOXXXOO
gerritUrl = https://review.gerrithub.io
connectTimeout = 30
fetchProtocols = http ssh git
netrcPath = ~/.netrc
delimiter = ....................
delimiterEnd = ********************
patchPreview = git log --oneline -1

Features

  1. Input a list of change numbers, pick-patch can help you cherry pick patches from Gerrit server
  2. Reolve install path automatically (if your project is created by Repo). You can cherry pick multiple patches in different repositories at the same time
$pick-patch -g https://gerrit.mycompany.com 1234 5566 7788/1
Getting patches from 'https://gerrit.mycompany.com' ...
Fetching and installing patches
------------------------------------------------------------
[kernel]
Pick: https://gerrit.mycompany.com/kernel refs/changes/34/1234/5
------------------------------------------------------------
...
============================================================
[middleware]
Pick: https://gerrit.mycompany.com/middleware refs/changes/66/5566/3
------------------------------------------------------------
...
============================================================
[app]
Pick: https://gerrit.mycompany.com/app refs/changes/88/7788/1
------------------------------------------------------------
...
============================================================
  1. Support gerrit search changes and cherry pick
$pick-patch -g https://gerrit.mycompany.com -q 'branch:master after:"2018-01-01"'
Querying change numbers from 'https://gerrit.mycompany.com'
Searching patches by 'branch:master after:"2018-01-01"' ...
------------------------------------------------------------
  1234 - kernel: add defconfig
  5566 - middleware: fix playback issue
  7788 - app: Update UI
(Total: 3 changes)
============================================================
Getting patches from 'https://gerrit.mycompany.com' ...
Fetching and installing patches
------------------------------------------------------------
[kernel]
Pick: https://gerrit.mycompany.com/kernel refs/changes/34/1234/5
------------------------------------------------------------
...
============================================================
[middleware]
Pick: https://gerrit.mycompany.com/middleware refs/changes/66/5566/3
------------------------------------------------------------
...
============================================================
[app]
Pick: https://gerrit.mycompany.com/app refs/changes/88/7788/2
------------------------------------------------------------
...
============================================================

Usage

usage: pick-patch [-h] [-u USER] [-p PASSWORD] [-q QUERY] [--query-only]
                  [-r PREVIEW] [-g GERRIT] [-d] [-n NETRC_FILE]
                  [-c CONFIG_FILE] [-m NAME.xml] [-i INSTALL_PATH] [-F] [-N]
                  [-x EXE] [--verbose] [-v]
                  [change_num [change_num ...]]

positional arguments:
  change_num            ex. '12345', '12345/1'

optional arguments:
  -h, --help            show this help message and exit
  -u USER, --user USER  gerrit user id
  -p PASSWORD, --password PASSWORD
                        gerrit HTTP password
  -q QUERY, --query QUERY
                        get patches from query command (change_num arguments
                        will be ignored if any) ex. 'branch:master
                        status:merged after:"2018-11-17 22:06:00"'
  --query-only          do not install patch
  -r PREVIEW, --preview PREVIEW
                        preview command for changes (default: git log --no-
                        decorate -1)
  -g GERRIT, --gerrit GERRIT
                        gerrit server url (default:
                        https://review.gerrithub.io)
  -d, --dryrun          show what would be done
  -n NETRC_FILE, --netrc-file NETRC_FILE
                        netrc path (default: ~/.netrc). (if user or password
                        has been specified, netrc config will be ignored)
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        config path (default: ~/.pickrc)
  -m NAME.xml, --manifest NAME.xml
                        assign manifest file to resolve patch install path
                        instead of using repo command
  -i INSTALL_PATH, --install-path INSTALL_PATH
                        assign patch install path instead of resolving path by
                        repo command or manifest
  -F, --full-path       display the full install path instead of the relative
                        install path
  -N, --name-path       display the project name instead of the relative
                        install path
  -x EXE, --exec EXE    append command after all changes installed in each
                        project
  --verbose             show more logs
  -v, --version         show program's version number and exit

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

pick-patch-1.1.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pick_patch-1.1.2-py2.py3-none-any.whl (12.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pick-patch-1.1.2.tar.gz.

File metadata

  • Download URL: pick-patch-1.1.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for pick-patch-1.1.2.tar.gz
Algorithm Hash digest
SHA256 405446490a754180a72b42042061158a2e419018f1f2fc1aee32058dcff7964b
MD5 8f224ce17fcd3bf90cdb77e72827db4d
BLAKE2b-256 ed69951aee906399736684f2e33fe43df9e3dcbc30d61b03b5ebd47051561db4

See more details on using hashes here.

File details

Details for the file pick_patch-1.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pick_patch-1.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for pick_patch-1.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fa940ea4236f7bfc698242f5f768bc5ec199991e9458a355ebb53d5710a39c6b
MD5 7226b26af4a3895f7bdda910d097455b
BLAKE2b-256 9d229721bf2bd7c7376bf008d57eb4d1c0a8becc3da03d2de2f732ef90416101

See more details on using hashes here.

Supported by

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