question about bzrlib/changeset.py

Aaron Bentley aaron.bentley at utoronto.ca
Tue Sep 6 14:03:29 BST 2005


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

Alexander Belchenko wrote:
>         try:
>             os.rmdir(filename)
>         except OSError, e:
>             if e.errno != 39:
>                 raise
>             if conflict_handler.rmdir_non_empty(filename) == "skip":
>                 return
>             os.rmdir(filename)
> 
> I have two questions.
> First, I think that comparing with constant 39 is not portable solution.
> May be it need to be:
> 
>     if e.errno != errno.ENOTEMPTY:

Sure.  I wasn't aware of the errno module when I wrote that.

> Second, I not competely understand why for second call to os.rmdir (last
> line in the above fragment) if first attempt raise exception?

If the conflict handler returns "continue", rather than "skip", that
indicates that the conflict handler has done something to make the
directory empty, so the rmdir will succeed.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDHZOh0F+nu1YWqI0RAtQ9AJ9x17ZLIZky9yQK0rrZa48Xl4rmOQCfYFXj
RR0l4u0NkdRbqJDOaEi/zxQ=
=CYun
-----END PGP SIGNATURE-----




More information about the bazaar mailing list