File tree 1 file changed +7
-5
lines changed
Filter options
cherry_picker/cherry_picker 1 file changed +7
-5
lines changed
Original file line number Diff line number Diff line change 3
3
4
4
import click
5
5
import collections
6
+ import enum
6
7
import os
7
8
import subprocess
8
9
import webbrowser
@@ -40,9 +41,9 @@ class InvalidRepoException(Exception):
40
41
41
42
class CherryPicker :
42
43
43
- ALLOWED_STATES = (
44
- 'BACKPORT_PAUSED ' ,
45
- 'UNSET' ,
44
+ ALLOWED_STATES = enum . Enum (
45
+ 'Allowed states ' ,
46
+ 'BACKPORT_PAUSED UNSET' ,
46
47
)
47
48
"""The list of states expected at the start of the app."""
48
49
@@ -435,12 +436,13 @@ def get_state_and_verify(self):
435
436
cherry_picker would have stored in the config.
436
437
"""
437
438
state = get_state ()
438
- if state not in self .ALLOWED_STATES :
439
+ if state not in self .ALLOWED_STATES . __members__ :
439
440
raise ValueError (
440
441
f'Run state cherry-picker.state={ state } in Git config '
441
442
'is not known.\n Perhaps it has been set by a newer '
442
443
'version of cherry-picker. Try upgrading.\n '
443
- f'Valid states are: { ", " .join (self .ALLOWED_STATES )} . '
444
+ 'Valid states are: '
445
+ f'{ ", " .join (self .ALLOWED_STATES .__members__ .keys ())} . '
444
446
'If this looks suspicious, raise an issue at '
445
447
'https://github.com/python/core-workflow/issues/new.\n '
446
448
'As the last resort you can reset the runtime state '
You can’t perform that action at this time.
0 commit comments