[MERGE][0.15] handle ERROR_DIRECTORY for win32 "bzr status filename"

Alexander Belchenko bialix at ukr.net
Wed Mar 21 06:08:34 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel пишет:
> I updated my patch according to Alexander's and Andrew's python2.5 feedback.
> 
> See attached.

There is small typo in your patch. See below.

> 
> === modified file bzrlib/workingtree_4.py
> --- bzrlib/workingtree_4.py
> +++ bzrlib/workingtree_4.py
> @@ -96,6 +96,12 @@
>  from bzrlib.workingtree import WorkingTree, WorkingTree3, WorkingTreeFormat3
>  
>  
> +# This is the Windows equivalent of ENOTDIR
> +# It is defined in pywin32.winerror, but we don't want a strong dependency for
> +# just an error code.
> +ERROR_DIRECTORY = 267
> +
> +
>  class WorkingTree4(WorkingTree3):
>      """This is the Format 4 working tree.
>  
> @@ -2063,10 +2069,17 @@
>                  try:
>                      current_dir_info = dir_iterator.next()
>                  except OSError, e:
> -                    if e.errno in (errno.ENOENT, errno.ENOTDIR):
> -                        # there may be directories in the inventory even though
> -                        # this path is not a file on disk: so mark it as end of
> -                        # iterator
> +                    # on win32, python2.4 has e.errno == ERROR_DIRECTORY, but
> +                    # python 2.5 has e.errno == EINVAL,
> +                    #            and e.winerror == ERROR_DIRECTORY
> +                    e_winerror = getattr(e, 'winerror', None)
> +                    # there may be directories in the inventory even though
> +                    # this path is not a file on disk: so mark it as end of
> +                    # iterator
> +                    if e.errno in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
> +                        current_dir_info = None
> +                    elif (sys.platform == 'win32'
> +                          and ERROR_DIRECTORY in (e.errno, e_winerror)):
>                          current_dir_info = None
>                      else:
>                          raise

^-- this should be e.winerror instead of e_winerror.

+1 conditional. (But you already merge this).

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGAMvizYr338mxwCURAoENAJ4iBvn5MOxEZAhUsldyuFAnJBmyOQCeLdQl
moN7quYahmn9v82tD21TqO4=
=qXAi
-----END PGP SIGNATURE-----



More information about the bazaar mailing list