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

Aaron Bentley aaron at aaronbentley.com
Thu May 12 17:55:58 UTC 2011


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

On 11-05-06 04:05 PM, Alexander Belchenko wrote:
> I think this is genuine bug in bzrdir search algorithm or maybe in
> find_branches code, but: the latter tries to open every directory and
> *every* plain file as bzrdir object. I suppose the original intent was
> open_bzrdir always search directories upwards, but find_branches have
> to search downwards but it never take care about skipping plain files.

Checking whether a path is a directory is not possible on all transports
(e.g. http), and it's also an extra round-trip.  So I thought it made
sense to just assume it was a directory, and handle the error if it
turned out not to be one.  Easier to ask forgiveness than permission.

> Is it really bug as I think

Well, it's intentional.

> or bzrdir name does not implies it should
> be dir only and should support files too?

No, that wasn't intended.

> Do you think it should skip
> files and check directories only?

I think that would be a sensible optimization for the smart server
implementation.

> Dp ypu think current behavior have
> some performance penalties because it doing too much useless work?

In the bzr case, it should have performance benefits because it avoids
an unnecessary round-trip in the case that the path is a directory.
Foreign branch support may complicate this picture.

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

iEYEARECAAYFAk3MHy4ACgkQ0F+nu1YWqI2mtwCfZ4ZIy7CHgLVV8Hx5N6nwzvFW
qEYAnjIP/NIAdOFq2wWJcxfTyN8g5wSX
=viea
-----END PGP SIGNATURE-----



More information about the bazaar mailing list