

def main():
    if (len(sys.argv) <= 2):
        die('Usage: test-upgrade.py branch1 branch2 [branchN...]\n')
    if (not os.path.exists('setup.py')):
        die('This must be run from the root of the Review Board tree.\n')
    branches = parse_options(sys.argv[1:])
    for branch in branches:
        errcode = execute(['git', 'rev-parse', branch], return_errcode=True, show_output=False)[1]
        if (errcode != 0):
            die(('Unable to resolve branch %s\n' % branch))
    cur_dir = os.getcwd()
    git_dir = clone_git_tree(cur_dir)
    print(('Review Board cloned to %s' % git_dir))
    run_python(['./contrib/internal/prepare-dev.py', '--no-media', '--no-db', ('--database-type=%s' % options.db_type), ('--database-name=%s' % options.db_name), ('--database-user=%s' % options.db_user), ('--database-password=%s' % options.db_password)])
    for branch in branches:
        execute(['git', 'checkout', branch])
        clean_pyc()
        run_python(['./reviewboard/manage.py', 'syncdb', '--noinput'])
        run_python(['./reviewboard/manage.py', 'evolve', '--execute', '--noinput'])
    os.chdir(cur_dir)
    shutil.rmtree(git_dir)
    print()
    print('***')
    print('*** Success!')
    print('***')

dataset/ETHPy150Open reviewboard/reviewboard/contrib/internal/test-upgrade.py main/original