def METHOD_NAME(revisions, refs):
    """Determine all the points where the history of the specified revisions intersects the specified refs."""
    queue = collections.deque(revisions)
    seen = set()
    for rev in iter_except(queue.popleft, IndexError):
        if rev in seen:
            continue
        parents = check_output(['git', 'rev-parse', '%s^@' % rev]).splitlines()
        yield rev
        seen.add(rev)
        if not parents:
            continue
        check_refs = check_output(['git', 'merge-base', '--independent'] + sorted(refs)).splitlines()
        for parent in parents:
            for ref in check_refs:
                print("Checking %s vs %s" % (parent, ref))
                try:
                    merge_base = check_output(['git', 'merge-base', parent, ref]).rstrip()
                except subprocess.CalledProcessError:
                    continue
                else:
                    queue.append(merge_base)