@@ -119,7 +119,6 @@ def __init__(
119119 self .config = config
120120 self .check_repo () # may raise InvalidRepoException
121121
122- self .initial_state = self .get_state_and_verify ()
123122 """The runtime state loaded from the config.
124123
125124 Used to verify that we resume the process from the valid
@@ -540,9 +539,10 @@ def abort_cherry_pick(self):
540539 """
541540 run `git cherry-pick --abort` and then clean up the branch
542541 """
543- if self .initial_state != WORKFLOW_STATES .BACKPORT_PAUSED :
542+ state = self .get_state_and_verify ()
543+ if state != WORKFLOW_STATES .BACKPORT_PAUSED :
544544 raise ValueError (
545- f"One can only abort a paused process. Current state: { self . initial_state } . Expected state: { WORKFLOW_STATES .BACKPORT_PAUSED } "
545+ f"One can only abort a paused process. Current state: { state } . Expected state: { WORKFLOW_STATES .BACKPORT_PAUSED } "
546546 )
547547
548548 try :
@@ -572,8 +572,11 @@ def continue_cherry_pick(self):
572572 open the PR
573573 clean up branch
574574 """
575- if self .initial_state != WORKFLOW_STATES .BACKPORT_PAUSED :
576- raise ValueError ("One can only continue a paused process." )
575+ state = self .get_state_and_verify ()
576+ if state != WORKFLOW_STATES .BACKPORT_PAUSED :
577+ raise ValueError (
578+ f"One can only continue a paused process. Current state: { state } . Expected state: { WORKFLOW_STATES .BACKPORT_PAUSED } "
579+ )
577580
578581 cherry_pick_branch = get_current_branch ()
579582 if cherry_pick_branch .startswith ("backport-" ):
@@ -637,8 +640,9 @@ def check_repo(self):
637640 """
638641 try :
639642 validate_sha (self .config ["check_sha" ])
640- except ValueError :
641- raise InvalidRepoException ()
643+ self .get_state_and_verify ()
644+ except ValueError as ve :
645+ raise InvalidRepoException (ve .args [0 ])
642646
643647 def get_state_and_verify (self ):
644648 """Return the run progress state stored in the Git config.
0 commit comments