def cvs_walk(currdir):
    """ walk through a CVS hierarchy

    Modeled after os.walk, this generator returns a topdown list of (currdir, dirs,
    files) tuples based on the CVS hierarchy.

    """
    dirs = []
    files = []
    if os.path.isdir(dir) and os.path.isdir(os.path.join(currdir, 'CVS')):
        for entry in open(os.path.join(currdir, 'CVS', 'Entries')):
            e = entry.split('/')
            if (len(e) > 1):
                if e[0] == 'D':
                    dirs.append(e[1])
                else:
                    files.append(e[1])
    yield (currdir, dirs, files)
    for d in dirs:
        for x in cvs_walk(os.path.join(currdir, d)):
            yield x
 walk through a CVS hierarchy

    Modeled after os.walk, this generator returns a topdown list of (currdir, dirs,
    files) tuples based on the CVS hierarchy.

    
recipes/Python/576378_walk_a_local_CVS_directory_tree/recipe-576378.py