bug? find_branches or find_bzrdir tries to open all files as bzr locations

John Yates john.yates at us.ibm.com
Wed May 18 02:39:33 UTC 2011


If the intent is only to locate directories then building on standard 
python libraries is essentially a reduction to lowest common denominator. 
All modern operating systems support some form of efficient directory 
scanning which returns basic stat info (in particular the entry type). 
Posix readdir() is carefully specified to allowed buffered reading of 
directory entries.  I know that glibc exploits this freedom.  On Windows 
FindFirstFileEx / FindNextFile can even be configured to return only 
directories.

The C+++ Boost project in its filesystem library provides 
basic_directory_iterator and basic_recursive_directory_iterator classes. 
Though I have not delved into the code, given the Boost project's emphasis 
on efficiency, my guess is that their implementations exploit the obvious 
opportunities for optimization on the most popular operating systems. They 
could serve as an implementation outline for a similar pair of Python 
classes.

/john



More information about the bazaar mailing list