python / cherry-picker

🐍🍒⛏ Utility script for backporting/cherry-picking CPython changes from master into one of the maintenance branches.
Apache License 2.0
46 stars 38 forks source link

Add support for git clones made with the `--mirror` option #63

Closed ambv closed 1 year ago

ambv commented 2 years ago

In case of a git repository mirror, all branches are kept in sync all the time. Trying to push out a particular refspec errors out with:

Failed to push to origin ☹
fatal: --mirror can't be combined with refspecs

Moreover, when a cherry-pick is pushed and the branch gets auto-deleted by cherry-picker, this introduces a dangerous situation for --mirror users. Again, with --mirror all branches are kept in sync. If I delete a branch locally from my ambv/cpython repository and then I push this change to GitHub, the remote branch will get automatically deleted on GitHub as well. So, if cherry-picker deletes a branch for PR-1, and then I push another unrelated change before PR-1 gets merged, PR-1 will get automatically closed by GitHub because the branch got deleted.

This change adds support for mirrors. Tested with:

https://github.com/python/cpython/pull/92981 https://github.com/python/cpython/pull/94495 https://github.com/python/cpython/pull/94496 (pushing this one didn't auto-close the previous one)

ambv commented 2 years ago

Now handling multiple open backports with --mirror is also correct (see the original description of the PR for details).

ambv commented 1 year ago

I'm landing this as I'm using it week-by-week for a few months now with no issues.