'Clones the Halyard git repo at the commit at which we built the nightly version.'

def __checkout_halyard_repo(self):

    bucket_uri = self.__hal_nightly_bucket_uri
    local_bucket_name = os.path.basename(bucket_uri)
    print 'cloning:    {0}'.format(self.__halyard_repo_uri)
    check_run_quick('git    clone    {0}'.format(self.__halyard_repo_uri))
    print 'Fetching    Halyard    nightly    build    info    from    {0}.    Writing    locally    to    {1}.'.format(bucket_uri, local_bucket_name)
    if (not os.path.exists(local_bucket_name)):
        os.mkdir(local_bucket_name)
    check_run_quick('gsutil    rsync    -r    -d    {remote_uri}    {local_bucket}'.format(remote_uri=bucket_uri, local_bucket=local_bucket_name))
    nightly_commit_file = '{0}/nightly-version-commits.yml'.format(local_bucket_name)
    nightly_commit_dict = {}
    with open(nightly_commit_file, 'r') as ncf:
        nightly_commit_dict = yaml.load(ncf.read())
    commit_to_build = nightly_commit_dict.get(self.__nightly_version, None)
    if (not commit_to_build):
        raise ValueError('No    commit    hash    recorded    in    {bucket}    for    Halyard    nightly    version    {nightly},    exiting.'.format(bucket=bucket_uri, nightly=self.__nightly_version))
    print 'Checking    out    Halyard    from    {0}    repo    at    commit    {1}.'.format(self.__halyard_repo_uri, commit_to_build)
    check_run_quick('git    -C    halyard    checkout    {0}'.format(commit_to_build))
