Rev 2365: Clean up the error. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/win32_notdir

John Arbash Meinel john at arbash-meinel.com
Mon Mar 19 23:25:13 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/win32_notdir

------------------------------------------------------------
revno: 2365
revision-id: john at arbash-meinel.com-20070319232456-oal04x9alxvsbuqu
parent: john at arbash-meinel.com-20070319231030-blqw1ylij3g290gg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32_notdir
timestamp: Mon 2007-03-19 18:24:56 -0500
message:
  Clean up the error.
modified:
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-19 23:10:30 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-19 23:24:56 +0000
@@ -1985,12 +1985,6 @@
                 ## import pdb;pdb.set_trace()
             return ()
 
-        not_dir_exceptions = (OSError,)
-        if sys.platform == 'win32':
-            # os.listdir('file') raises WindowsError on win32, rather than
-            # raising an OSError
-            not_dir_exceptions = (OSError, WindowsError)
-
         while search_specific_files:
             # TODO: the pending list should be lexically sorted?  the
             # interface doesn't require it.
@@ -2074,11 +2068,10 @@
                 dir_iterator = osutils._walkdirs_utf8(root_abspath, prefix=current_root)
                 try:
                     current_dir_info = dir_iterator.next()
-                except not_dir_exceptions, e:
-                    errno = getattr(e, 'errno', None)
-                    winerrno = getattr(e, 'winerror', None)
-                    if (errno in (errno.ENOENT, errno.ENOTDIR)
-                        or winerrno in (ERROR_DIRECTORY,)):
+                except OSError, e:
+                    if (e.errno in (errno.ENOENT, errno.ENOTDIR)
+                        or (sys.platform == 'win32'
+                            and e.errno in (ERROR_DIRECTORY,))):
                         # there may be directories in the inventory even though
                         # this path is not a file on disk: so mark it as end of
                         # iterator



More information about the bazaar-commits mailing list