Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
  • Loading branch information
hugovk and ezio-melotti committed Mar 23, 2024
1 parent 36a4103 commit 56c66a9
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ Options:
## About

This tool is used to backport CPython changes from `main` into one or more
of the maintenance branches (`3.6`, `3.5`, `2.7`).
of the maintenance branches (e.g. `3.12`, `3.11`).

`cherry_picker` can be configured to backport other projects with similar
workflow as CPython. See the configuration file options below for more details.

The maintenance branch names should contain some sort of version number (X.Y).
For example: `3.6`, `3.5`, `2.7`, `stable-2.6`, `2.5-lts`, are all
supported branch names.
The maintenance branch names should contain some sort of version number (`X.Y`).
For example: `3.12`, `stable-3.12`, `1.5`, `1.5-lts`, are all supported branch
names.

It will prefix the commit message with the branch, e.g. `[3.6]`, and then
It will prefix the commit message with the branch, e.g. `[3.12]`, and then
open up the pull request page.

Write tests using [pytest](https://docs.pytest.org/).
Expand Down Expand Up @@ -200,29 +200,29 @@ To customize the tool for used by other project:
### Example

For example, to cherry-pick `6de2b7817f-some-commit-sha1-d064` into
`3.5` and `3.6`, run the following command from the cloned CPython
`3.12` and `3.11`, run the following command from the cloned CPython
directory:

```console
(venv) $ cherry_picker 6de2b7817f-some-commit-sha1-d064 3.5 3.6
(venv) $ cherry_picker 6de2b7817f-some-commit-sha1-d064 3.12 3.11
```

What this will do:

```console
(venv) $ git fetch upstream

(venv) $ git checkout -b backport-6de2b78-3.5 upstream/3.5
(venv) $ git checkout -b backport-6de2b78-3.12 upstream/3.12
(venv) $ git cherry-pick -x 6de2b7817f-some-commit-sha1-d064
(venv) $ git push origin backport-6de2b78-3.5
(venv) $ git push origin backport-6de2b78-3.12
(venv) $ git checkout main
(venv) $ git branch -D backport-6de2b78-3.5
(venv) $ git branch -D backport-6de2b78-3.12

(venv) $ git checkout -b backport-6de2b78-3.6 upstream/3.6
(venv) $ git checkout -b backport-6de2b78-3.11 upstream/3.11
(venv) $ git cherry-pick -x 6de2b7817f-some-commit-sha1-d064
(venv) $ git push origin backport-6de2b78-3.6
(venv) $ git push origin backport-6de2b78-3.11
(venv) $ git checkout main
(venv) $ git branch -D backport-6de2b78-3.6
(venv) $ git branch -D backport-6de2b78-3.11
```

In case of merge conflicts or errors, the following message will be displayed:
Expand All @@ -245,24 +245,24 @@ Passing the `--dry-run` option will cause the script to print out all the
steps it would execute without actually executing any of them. For example:

```console
$ cherry_picker --dry-run --pr-remote pr 1e32a1be4a1705e34011770026cb64ada2d340b5 3.6 3.5
$ cherry_picker --dry-run --pr-remote pr 1e32a1be4a1705e34011770026cb64ada2d340b5 3.12 3.11
Dry run requested, listing expected command sequence
fetching upstream ...
dry_run: git fetch origin
Now backporting '1e32a1be4a1705e34011770026cb64ada2d340b5' into '3.6'
dry_run: git checkout -b backport-1e32a1b-3.6 origin/3.6
Now backporting '1e32a1be4a1705e34011770026cb64ada2d340b5' into '3.12'
dry_run: git checkout -b backport-1e32a1b-3.12 origin/3.12
dry_run: git cherry-pick -x 1e32a1be4a1705e34011770026cb64ada2d340b5
dry_run: git push pr backport-1e32a1b-3.6
dry_run: Create new PR: https://github.com/python/cpython/compare/3.6...ncoghlan:backport-1e32a1b-3.6?expand=1
dry_run: git push pr backport-1e32a1b-3.12
dry_run: Create new PR: https://github.com/python/cpython/compare/3.12...ncoghlan:backport-1e32a1b-3.12?expand=1
dry_run: git checkout main
dry_run: git branch -D backport-1e32a1b-3.6
Now backporting '1e32a1be4a1705e34011770026cb64ada2d340b5' into '3.5'
dry_run: git checkout -b backport-1e32a1b-3.5 origin/3.5
dry_run: git branch -D backport-1e32a1b-3.12
Now backporting '1e32a1be4a1705e34011770026cb64ada2d340b5' into '3.11'
dry_run: git checkout -b backport-1e32a1b-3.11 origin/3.11
dry_run: git cherry-pick -x 1e32a1be4a1705e34011770026cb64ada2d340b5
dry_run: git push pr backport-1e32a1b-3.5
dry_run: Create new PR: https://github.com/python/cpython/compare/3.5...ncoghlan:backport-1e32a1b-3.5?expand=1
dry_run: git push pr backport-1e32a1b-3.11
dry_run: Create new PR: https://github.com/python/cpython/compare/3.11...ncoghlan:backport-1e32a1b-3.11?expand=1
dry_run: git checkout main
dry_run: git branch -D backport-1e32a1b-3.5
dry_run: git branch -D backport-1e32a1b-3.11
```

### `--pr-remote` option
Expand Down Expand Up @@ -321,7 +321,7 @@ tab that points to the pull request creation page.
The url of the pull request page looks similar to the following:

```
https://github.com/python/cpython/compare/3.5...<username>:backport-6de2b78-3.5?expand=1
https://github.com/python/cpython/compare/3.12...<username>:backport-6de2b78-3.12?expand=1
```

Press the `Create Pull Request` button.
Expand Down

0 comments on commit 56c66a9

Please sign in to comment.