Example #1
0
def request(repo=None):
    repo = get_repo(repo)
    try:
        pull = _create_pull_request(repo)
    except GithubException as e:
        _handle_github_exception(e, 'create a pull request')

    repo.git.commit('--amend', '-m', '%s\n\n%s: %s' % (repo.head.commit.message, PULL_REQUEST_COMMIT_TAG, pull.html_url))
    print 'Pull request URL: %s' % pull.html_url
Example #2
0
 def __call__(self, config_level='global'):
     repo = git_utils.get_repo()
     config_writer = repo.config_writer(config_level)
     # it does not have to be recursive as there are only two levels
     for command in self.main.nested_commands():
         if len(command.nested_commands()) != 0:
             for subcommand in command.nested_commands():
                 alias = '%s-%s' % (command.name, subcommand.name)
                 config_writer.set_value('alias', alias, '"!%s %s %s"' % (sys.argv[0], command.name, subcommand.name))
     config_writer.release()
Example #3
0
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))
Example #4
0
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()
Example #5
0
def _configuration(repo=None):
    repo = get_repo(repo)
    return Configuration(repo, 'slack', {
        'access-token': (NOT_SET, 'Slack access token'),
        'notification-channel': (NOT_SET, 'Slack channel to where notification will be send')
    })
Example #6
0
def _configuration(repo=None):
    repo = get_repo(repo)
    return Configuration(repo, 'github', {
        'login': (NOT_SET, 'Github login'),
        'access-token': (NOT_SET, 'Github access token')
    })
Example #7
0
def _list():
    repo = get_repo()
    return repo.git.stash('list')
Example #8
0
def _pop_finish(repo=None):
    repo = get_repo(repo)
    commit_message = repo.git.stash('list', '--max-count=1', '--oneline')
    commit_message = ': '.join(commit_message.split(': ')[2:])
    repo.git.commit('-am', _unescape_new_lines(commit_message))
    repo.git.stash('drop')