/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Robert Collins
  • Date: 2006-06-10 19:32:47 UTC
  • mto: (1767.2.2 integration)
  • mto: This revision was merged to the branch mainline in revision 1769.
  • Revision ID: robertc@robertcollins.net-20060610193247-be43e4f7c71fb77f
Teach walkdirs to walk a subdir of a tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
810
810
        raise IllegalPath(path)
811
811
 
812
812
 
813
 
def walkdirs(top):
 
813
def walkdirs(top, prefix=""):
814
814
    """Yield data about all the directories in a tree.
815
815
    
816
816
    This yields all the data about the contents of a directory at a time.
820
820
    The data yielded is of the form:
821
821
    [(relpath, basename, kind, lstat, path_from_top), ...]
822
822
 
 
823
    :param prefix: Treat prefix as the initial root of the tree, rather than ""
823
824
    :return: an iterator over the dirs.
824
825
    """
825
826
    lstat = os.lstat
826
827
    pending = []
827
828
    _directory = _directory_kind
828
829
    _listdir = listdir
829
 
    pending = [("", "", _directory, None, top)]
 
830
    pending = [(prefix, "", _directory, None, top)]
830
831
    while pending:
831
832
        dirblock = []
832
833
        currentdir = pending.pop()