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

Problems with pushing into remote repository #121

Open serhiy-storchaka opened 4 months ago

serhiy-storchaka commented 4 months ago

Something gone wrong, so I decided to recreate the backport. But the second attempt failed. As well as all following. Here is the result of the last failure.:

$ cherry_picker --continue
🐍 🍒 ⛏
Failed to push to origin ☹
To github.com:serhiy-storchaka/cpython.git
 ! [rejected]              backport-8f60298-3.11 -> backport-8f60298-3.11 (stale info)
error: не вдалося надіслати деякі посилання в «github.com:serhiy-storchaka/cpython.git»

branch backport-8f60298-3.11 has been deleted.

Backport PR:
...

I tried to remove the branch in my GitHub clone, but it did not help until I pulled from it into my local clone.

It seems, that when something gone wrong, cherry_picker pushed the broken branch into my remote repository on GitHub and removed it from the local repository. In the following attempts it failed to push into the remote repository (either because it already existed, or because it was removed, but it did not know about this), but removed the branch from the local repository anyway.

I expect from it to use more forced method to push the branch into the remote repository (if it is already not used), and if the operation fails due to stale info, try to pull from the remote repository and repeat.

And of course it should not just remove the branch from the local repository. Instead it should keep it until you fix the error and continue with cherry_picker --continue, or give up and cancel it with cherry_picker --abort.