def push_upstream(self, remote_branch): """Push the current branch to upstream. Args: remote_branch (unicode): The name of the branch to push to. Raises: rbtools.client.errors.PushError: The branch was unable to be pushed. """ origin_url = self._get_origin()[1] rc, output = self._execute( ['git', 'pull', '--rebase', origin_url, remote_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError('Could not pull changes from upstream.') rc, output = self._execute( ['git', 'push', origin_url, remote_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError('Could not push branch "%s" to upstream' % remote_branch)
def push_upstream(self, remote_branch): """Pushes the current branch to upstream.""" origin_url = self.get_origin()[1] rc, output = execute( ['git', 'pull', '--rebase', origin_url, remote_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError('Could not pull changes from upstream.') rc, output = execute(['git', 'push', origin_url, remote_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError("Could not push branch '%s' to upstream" % remote_branch)
def push_upstream(self, local_branch): """Push the current branch to upstream. Args: local_branch (unicode): The name of the branch to push. Raises: rbtools.client.errors.PushError: The branch was unable to be pushed. """ rc, output = self._execute( ['git', 'config', '--get', 'branch.%s.remote' % local_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError('Could not determine remote for branch "%s".' % local_branch) else: origin = output.strip() rc, output = self._execute( ['git', 'pull', '--rebase', origin, local_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError('Could not pull changes from upstream.') rc, output = self._execute( ['git', 'push', origin, local_branch], ignore_errors=True, return_error_code=True) if rc: raise PushError('Could not push branch "%s" to upstream.' % local_branch)