Skip to content
/ backport Public

Create backport PR automatically (tool for CuPy maintainers)

License

Notifications You must be signed in to change notification settings

cupy/backport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automate backport PR

Prerequisites

Requires installation of PyGithub

pip install pygithub

Token is provided from Github. Scope with repo/public_repo is required.

Script requires authentication to github.com via SSH. Directions here.

Usage

usage: backport.py [-h] --repo {chainer,cupy} --token TOKEN --pr PR
                   [--branch BRANCH] [--debug] [--continue]
                   [--abort-before-push]

optional arguments:
  -h, --help            show this help message and exit
  --repo {chainer,cupy}
                        chainer or cupy
  --token TOKEN         GitHub access token.
  --pr PR               The original PR number to be backported.
  --branch BRANCH       Target branch to make a backport
  --debug
  --continue            Continues the process suspended by conflict situation.
                        Run from the working tree directory.
  --abort-before-push   Abort the procedure before making an push. Useful if
                        you want to make some modification to the backport
                        branch. Use --continue to make an actual push after
                        making modification.

Example

$ python backport.py --repo chainer --token abcdefghijklmn --pr 1234

How it works

Basically it follows this procedure:

  1. Clone the target branch (e.g. v5) of the target repository (e.g. chainer/chainer) to a temporary directory.
  2. Create a local temporary branch and cherry-pick the merge commit of the original PR.
  3. Push it to the user repository.
  4. Make a backport PR.

In the case of conflict

If conflict has occurred during backporting, you have to resolve conflict yourself, and rerun the command with additional --continue option.

$ python backport.py --repo chainer --token abcdefghijklmn --pr 1234
...
Cherry-pick failed.
Working tree is saved at: /tmp/bp-FktJXG5R
Go to the working tree, resolve the conflict and type `git cherry-pick --continue`,
then run this script with --continue option.

$ cd /tmp/bp-FktJXG5R

$ <resolve conflict>

$ git cherry-pick --continue

$ python backport.py --repo chainer --token abcdefghijklmn --pr 1234 --continue

About

Create backport PR automatically (tool for CuPy maintainers)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages