def rename(self, rietveld_info): """Renames the source branch and moves the Rietveld info as well. If successful, sets state to FINISHED. Args: rietveld_info: RietveldInfo object for the branch. Is copied over to the new branch. Raises: GitRvException: If rietveld_info is None. """ if rietveld_info is None: raise utils.GitRvException('Rename command received unexpected ' 'branch info.') print 'Renaming branch...' print utils.capture_command('git', 'branch', '-m', self.__source_branch, self.__target_branch, single_line=False) print 'Moving review info.' rietveld_info._branch_name = self.__target_branch rietveld_info.save() utils.RietveldInfo.remove(branch_name=self.__source_branch)
def advance(self, *args, **kwargs): """Advances by calling the method corresponding to the current state. Args: *args: Arguments to be passed to the specified method based on the current state. **kwargs: Keyword arguments to be passed to the specified method based on the current state. Raises: GitRvException: If this method is called and the state is not one of the valid states. """ if self.state == self.STARTING: self.check_environment(*args, **kwargs) elif self.state == self.CHECK_NEW: self.check_new_sync(*args, **kwargs) elif self.state == self.CHECK_CONTINUE: self.check_continue(*args, **kwargs) elif self.state == self.FETCH_REMOTE: self.fetch_remote(*args, **kwargs) elif self.state == self.MERGE_REMOTE_IN: self.merge(*args, **kwargs) elif self.state == self.ALERT_CONFLICT: self.alert(*args, **kwargs) elif self.state == self.EXPORT: self.export_to_review(*args, **kwargs) elif self.state == self.CLEAN_UP: self.clean_up(*args, **kwargs) elif self.state == self.FINISHED: return else: raise utils.GitRvException('Unexpected state %r in SyncAction.' % (self.state, ))
def advance(self, *args, **kwargs): """Advances by calling the method corresponding to the current state. Args: *args: Arguments to be passed to the specified method based on the current state. **kwargs: Keyword arguments to be passed to the specified method based on the current state. Raises: GitRvException: If this method is called and the state is not one of the valid states. """ if self.state == self.CHECK_ENVIRONMENT: self.check_environment(*args, **kwargs) elif self.state == self.VERIFY_APPROVAL: self.verify_approval(*args, **kwargs) elif self.state == self.UPDATE_FROM_METADATA: self.update_from_metadata(*args, **kwargs) elif self.state == self.ENTER_DETACHED_STATE: self.enter_detached_state(*args, **kwargs) elif self.state == self.SET_HISTORY_FROM_REMOTE: self.set_history_from_remote(*args, **kwargs) elif self.state == self.CREATE_BRANCH: self.create_branch(*args, **kwargs) elif self.state == self.COMMIT: self.commit(*args, **kwargs) elif self.state == self.PUSHING: self.push_commit(*args, **kwargs) elif self.state == self.NOTIFY_FAILURE: self.notify_failure(*args, **kwargs) elif self.state == self.CLEAN_UP_LOCAL: self.clean_up_local(*args, **kwargs) elif self.state == self.CLEAN_UP_REVIEW: self.clean_up_review(*args, **kwargs) elif self.state == self.FINISHED: return else: raise utils.GitRvException('Unexpected state %r in SubmitAction.' % (self.state, ))
def advance(self, *args, **kwargs): """Advances by calling the method corresponding to the current state. Args: *args: Arguments to be passed to the specified method based on the current state. **kwargs: Keyword arguments to be passed to the specified method based on the current state. Raises: GitRvException: If this method is called and the state is not one of the valid states. """ if self.state == self.CHECK_BRANCHES: self.check_branches(*args, **kwargs) elif self.state == self.RENAME: self.rename(*args, **kwargs) elif self.state == self.FINISHED: return else: raise utils.GitRvException('Unexpected state %r in ' 'RenameBranchAction.' % (self.state, ))
def advance(self, *args, **kwargs): """Advances by calling the method corresponding to the current state. Args: *args: Arguments to be passed to the specified method based on the current state. **kwargs: Keyword arguments to be passed to the specified method based on the current state. Raises: GitRvException: If this method is called and the state is not one of the valid states. """ if self.state == self.GET_INFO: self.get_info(*args, **kwargs) elif self.state == self.PULL: self.pull(*args, **kwargs) elif self.state == self.PRINT_INFO: self.print_info(*args, **kwargs) elif self.state == self.FINISHED: return else: raise utils.GitRvException( 'Unexpected state %r in GetInfoAction.' % (self.state, ))