Best way to check if a directory is an brz branch

Nicholas Allen nick.allen at onlinehome.de
Tue Feb 17 12:38:25 GMT 2009


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


>>
>> I expected a static method in Branch or BzrDir to check this. eg
>> is_branch(directory).
> See bzrlib.bzrdir.BzrDir.has_branch().

to do this I have to create a BzrDir object. Not that that's necessarily
a problem but I was hoping for a method that was static and took a file
system path as an argument.

To create a BzrDir object wouldn't that require a try except block? I
really want something I can use in an expression with the need for that.
If BzrDir.open can't throw any exceptions then I guess I can just do

BzrDir.open(directory).has_branch()

Unfortunately, the API does not indicate if an exception is thrown by
BzrDir.open and if so what kind it would be so I have no way of knowing.

I really don't know how you guys managed to develop such a great and
stable program in Python but I take my hat off to you!

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

iEYEARECAAYFAkmar8EACgkQ1+i51gqqEGk1swCeNWSZdAl8XUIISOfkoMdayqKU
wvYAn2OEIDf+wkSKm7auNY+q5CF57nmg
=8LM4
-----END PGP SIGNATURE-----



More information about the bazaar mailing list