def get_vcs_client(base_path):
    vcs_clients = []
    vcs_clients.append(GitClient)
    vcs_clients.append(HgClient)
    client_types = [c.type for c in vcs_clients]
    if len(client_types) != len(set(client_types)):
        raise RuntimeError('Multiple vcs clients share the same type: %s' % ', '.join(sorted(client_types)))

    for vcs_client in vcs_clients:
        if os.path.exists(os.path.join(base_path, '.%s' % vcs_client.type)):
            return vcs_client(base_path)
    raise RuntimeError('Could not detect repository type - currently supports: %s' % ', '.join([c.type for c in vcs_clients]))
dataset/ETHPy150Open ros-infrastructure/catkin_pkg/src/catkin_pkg/changelog_generator_vcs.py/get_vcs_client/original