Best way to check if a directory is an brz branch
Nicholas Allen
nick.allen at onlinehome.de
Tue Feb 17 11:51:00 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm wondering what's the best way to check if a directory on the file
system is a Bazaar branch. At the moment I do something like:
if os.path.isdir(os.path.join(directory, '.bzr/branch')):
but this seems overly tied to the implementation details of Bazaar. I
couldn't find a method to do this. One way would be to try to open a
branch for a directory and catch exceptions but that seems inefficient
and would also fail if there was a problem with the branch itself.
I expected a static method in Branch or BzrDir to check this. eg
is_branch(directory).
Cheers,
Nick
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmapKQACgkQ1+i51gqqEGnBZACfTB5huiMSt0yJf83RAPNjXhhj
nPwAn3UeredNoqyMnYjYvDy5S3b4pKvH
=xEB/
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list