def assess_review(self): """Checks if the branch is in a review or starting a new one. If not in a review, sets state to UPLOADING_ISSUE, else to UPDATING_ISSUE. Updates the state based on whether a review is in progress or just beginning and advances the state machine. """ if utils.in_review(rietveld_info=self.__rietveld_info): self.state = self.UPDATING_ISSUE else: self.state = self.UPLOADING_ISSUE self.advance()
def check_branch(self): """Checks if the branch can be deleted. We require that the branch exists, is not the current branch and is actually a review branch. If successful, sets state to DELETE, otherwise to FINISHED. """ if not utils.branch_exists(self.__branch): print 'Branch %r doesn\'t exist.' % (self.__branch,) self.state = self.FINISHED elif self.__branch == utils.get_current_branch(): print 'Can\'t delete current branch.' % (self.__branch,) self.state = self.FINISHED else: if not utils.in_review(current_branch=self.__branch): print 'Branch %r has no review in progress.' % (self.__branch,) print 'Instead, use the git command:' print '\tgit branch -D %s' % (self.__branch,) self.state = self.FINISHED else: self.state = self.DELETE self.advance()
def check_branch(self): """Checks if the branch can be deleted. We require that the branch exists, is not the current branch and is actually a review branch. If successful, sets state to DELETE, otherwise to FINISHED. """ if not utils.branch_exists(self.__branch): print 'Branch %r doesn\'t exist.' % (self.__branch, ) self.state = self.FINISHED elif self.__branch == utils.get_current_branch(): print 'Can\'t delete current branch.' % (self.__branch, ) self.state = self.FINISHED else: if not utils.in_review(current_branch=self.__branch): print 'Branch %r has no review in progress.' % ( self.__branch, ) print 'Instead, use the git command:' print '\tgit branch -D %s' % (self.__branch, ) self.state = self.FINISHED else: self.state = self.DELETE self.advance()