def _push(): repo = get_repo() check_repo_is_clean(repo) feature_config = feature.configuration(repo) base = '%s/%s' % (feature_config.working_remote, feature_config.target_branch) if repo.head.commit == repo.commit(base): raise CommandException('You are currently at %s, there is nothing to push' % base) commit_message = repo.head.commit.message repo.git.reset('--soft', 'HEAD^') repo.git.stash('save', _escape_new_lines(commit_message))
def _pop(): repo = get_repo() check_repo_is_clean(repo) if repo.git.stash('list') == '': raise CommandException('There is nothing in the queue to pop from.') try: repo.git.stash('apply', '--index') except GitCommandError as e: if 'Try without --index' in e.stderr: try: repo.git.stash('apply') except GitCommandError: raise CommandException('Unable to pop automatically. Resolve conflicts then run queue-pop-finish.') else: raise CommandException('Unable to pop automatically. Resolve conflicts then run queue-pop-finish.') _pop_finish()