

def setup_project(project):
    ' Setup a project for code review:\n\n    If there is :py:class:`.Remote` configured for code review,\n    using the ssh protocol, use it to fetch the gerrit ``commit-msg`` hook\n\n    '
    remote = project.review_remote
    server = remote.server
    username = remote.username
    ssh_port = remote.port
    commit_hook = os.path.join(project.path, '.git', 'hooks', 'commit-msg')
    if os.path.exists(commit_hook):
        return True
    ui.info('Configuring', ui.blue, project.src, ui.reset, 'for code review ... ', end='')
    if (remote.protocol == 'ssh'):
        (ok, out) = fetch_gerrit_hook_ssh(project.path, username, server, port=ssh_port)
        if (not ok):
            ui.info('\n', out, ui.red, '[FAILED]')
            return False
    ui.info(ui.green, '[OK]')
    return True

dataset/ETHPy150Open aldebaran/qibuild/python/qisrc/review.py setup_project/original