Пример #1
0
def _execute_branch_cut():
    # Do prerequisite checks.
    common.require_cwd_to_be_oppia()
    common.verify_local_repo_is_clean()
    common.verify_current_branch_name('develop')

    # Update the local repo.
    remote_alias = common.get_remote_alias('https://github.com/oppia/oppia')
    subprocess.call(['git', 'pull', remote_alias])

    _verify_target_branch_does_not_already_exist(remote_alias)
    _verify_target_version_is_consistent_with_latest_released_version()

    # The release coordinator should verify that tests are passing on develop
    # before checking out the release branch.
    common.open_new_tab_in_browser_if_possible(
        'https://github.com/oppia/oppia#oppia---')
    while True:
        print (
            'Please confirm: are Travis checks passing on develop? (y/n) ')
        answer = raw_input().lower()
        if answer in ['y', 'ye', 'yes']:
            break
        elif answer:
            print (
                'Tests should pass on develop before this script is run. '
                'Exiting.')
            sys.exit()

    # Cut a new release branch.
    print 'Cutting a new release branch: %s' % NEW_BRANCH_NAME
    subprocess.call(['git', 'checkout', '-b', NEW_BRANCH_NAME])

    # Update the version in app.yaml.
    print 'Updating the version number in app.yaml ...'
    with open('app.yaml', 'r') as f:
        content = f.read()
        assert content.count('version: default') == 1
    os.remove('app.yaml')
    content = content.replace(
        'version: default', 'version: %s' % NEW_APP_YAML_VERSION)
    with open('app.yaml', 'w+') as f:
        f.write(content)
    print 'Version number updated.'

    # Make a commit.
    print 'Committing the change.'
    subprocess.call([
        'git', 'commit', '-a', '-m',
        '"Update version number to %s"' % TARGET_VERSION])

    # Push the new release branch to GitHub.
    print 'Pushing new release branch to GitHub.'
    subprocess.call(['git', 'push', remote_alias, NEW_BRANCH_NAME])

    print ''
    print (
        'New release branch successfully cut. You are now on branch %s' %
        NEW_BRANCH_NAME)
    print 'Done!'
Пример #2
0
def _execute_branch_cut():
    """Pushes the new release branch to Github."""

    # Do prerequisite checks.
    common.require_cwd_to_be_oppia()
    common.verify_local_repo_is_clean()
    common.verify_current_branch_name('develop')

    # Update the local repo.
    remote_alias = common.get_remote_alias('[email protected]:oppia/oppia.git')
    subprocess.call(['git', 'pull', remote_alias])

    _verify_target_branch_does_not_already_exist(remote_alias)
    _verify_target_version_is_consistent_with_latest_released_version()

    # The release coordinator should verify that tests are passing on develop
    # before checking out the release branch.
    common.open_new_tab_in_browser_if_possible(
        'https://github.com/oppia/oppia#oppia---')
    while True:
        print (
            'Please confirm: are Travis checks passing on develop? (y/n) ')
        answer = raw_input().lower()
        if answer in ['y', 'ye', 'yes']:
            break
        elif answer:
            print (
                'Tests should pass on develop before this script is run. '
                'Exiting.')
            sys.exit()

    # Cut a new release branch.
    print 'Cutting a new release branch: %s' % NEW_BRANCH_NAME
    subprocess.call(['git', 'checkout', '-b', NEW_BRANCH_NAME])

    # Push the new release branch to GitHub.
    print 'Pushing new release branch to GitHub.'
    subprocess.call(['git', 'push', remote_alias, NEW_BRANCH_NAME])

    print ''
    print (
        'New release branch successfully cut. You are now on branch %s' %
        NEW_BRANCH_NAME)
    print 'Done!'