Beispiel #1
0
def _pull_request(pull, working_branch):
    if pull.user == Settings.USER:
        nickname = 'origin'
    else:
        try:
            nickname = Remote.inverse()[pull.user]
        except KeyError:
            Remote.add_remote(pull.user, pull.user)
            nickname = pull.user

    keywords = {
        'nickname': nickname,
        'pull_branch': pull.branch,
        'working_branch': working_branch,
        'print': print if ARGS.verbose else None,
    }

    Call.runlines(
        """git fetch {nickname} {pull_branch}
           git checkout {nickname}/{pull_branch}
           git rebase --preserve-merges {working_branch}""",
        **keywords)

    # Store the commit ID at this point so we can merge back to it.
    keywords['commit_id'] = Git.commit_id()
    Call.runlines(
        """git checkout {working_branch}
           git merge --ff-only {commit_id}""",
        **keywords)

    _check_vcxproj()
Beispiel #2
0
def _release(pulls, working_branch, next_branch, selector_name):
    Git.complete_reset()
    Delete.do_delete([working_branch], print=None)
    Git.copy_from_remote(base_branch(), working_branch, push=False)

    pulls.sort(key=operator.attrgetter('number'))

    if pulls:
        print('%s: Building release branch for %s:' % (
            String.timestamp(), selector_name))
        print('  ' + '\n  '.join(str(p) for p in pulls))
        print()

    success = []
    failure = []
    exceptions = []
    for pull in pulls:
        try:
            print(pull.number, '...', sep='', end='')
            _pull_request(pull, working_branch)
        except VcxprojException:
            failure.append(pull.number)
            print('VCXPROJ...', end='')
        except Exception as e:
            failure.append(pull.number)
            print('ERROR...', end='')
        else:
            success.append(pull.number)
    if pulls:
        print()
        print()

    Version.version_commit(
        version_number=None, success=success, failure=failure)

    commit_id = Git.commit_id()

    Git.force_checkout(next_branch)
    Git.git('reset', '--hard', commit_id)
    Git.git('push', '-f')

    commits = Open.get_commits()
    plural = '' if len(commits) == 1 else 's'
    _print_pulls('Proposed new develop branch %s for pull%s' %
                 (commits, plural), success)
    _print_pulls('FAILED:', failure)
    if success or failure:
        print('---------------------------------------------')
        print()
    else:
        print(String.timestamp(), ': no pulls ready.')
Beispiel #3
0
def release():
    previous_pulls = {}
    while True:
        base_commit = Git.commit_id(upstream=True, branch=base_branch())
        success = False
        for selector in SELECTORS:
            success = selector.update_pulls(base_commit) or success

        if success:
            Slack.slack()
        else:
            print(String.timestamp(short=True) + ': no change.')
        if ARGS.period:
            time.sleep(ARGS.period)
            Cache.clear()
        else:
            break