Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While I can't really confirm whether this has been an issue for miss-islington since I'm not running it myself (I am however working on a bot for a different project, which also uses
CherryPicker
API and I have ran in these kinds of issues), I believe this should fix some issues related to backport task trying to abort the cherry-pick when the backport fails.If I haven't missed something, before this change
abort_cherry_pick()
would fail to run due to CherryPicker'sinitial_state
not beingBACKPORT_PAUSED
.initial_state
is, as the name suggests, initial and therefore it doesn't get updated when a new state is set.This means that when
CherryPickException
is raised, theinitial_state
still is set toUNSET
rather thanBACKPORT_PAUSED
therefore not allowing to abort. To solve this, I make another instance ofCherryPicker
after this exception is raised.As for
BranchCheckoutException
, currently when this is raised, the state that cherry-picker ends up with isBACKPORT_LOOP_START
which is why instead of making another instance ofCherryPicker
(which would lead to an error due to it being an unallowed state; note: this can also be an issue when running cherry-picker from CLI), I resorted to a bit more hacky solution of just changing its state to a valid one. I know it would be better to solve this incherry-picker
itself in some way but I wasn't exactly sure how the maintainers of it would want to proceed about it. See python/cherry-picker#38