

def get_gerrit_username(server, ssh_port):
    ' Get the username to use when using code review.\n\n    Read it from the config file, or ask it and check it works\n    '
    qibuild_cfg = qibuild.config.QiBuildConfig()
    qibuild_cfg.read(create_if_missing=True)
    access = qibuild_cfg.get_server_access(server)
    if access:
        username = access.username
    else:
        username = ask_gerrit_username(server, ssh_port=ssh_port)
        if (not username):
            return None
    qibuild_cfg.set_server_access(server, username)
    qibuild_cfg.write()
    return username

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