Best way to check if a directory is an brz branch

Nicholas Allen nick.allen at onlinehome.de
Tue Feb 17 17:27:14 GMT 2009


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


> 
> You are welcome to propose a patch, write some tests, and get something
> merged into bzrlib. I'm not sure that bzr itself will have any use for
> that sort of function. Also, if there is a "broken branch" does that
> count as a real branch?

I think it would make sense that it does. If you later try to do
something with it then it would throw an exception anyway.

> 
> I don't know exactly what functionality you want, or how you are
> defining a "real branch". Care to explain a bit more as to why you want
> to know that a branch exists, but not actually do anything with the
> branch object?

I am improving the hookless email plugin. There is a class called
BranchEmailer that takes a path to a branch at construction. I need to
scan a directory recursively and add create branch emailers for each
branch I find. So I want to do something like:

if is_branch(dir):
	branch_emailers.add(BranchEmailer(dir))

I could change BranchEmailer to take a branch as an argument and not its
path I suppose. This is not a change I want to do because I think it
makes more sense how it is now.

But it's also easy to think of uses for such a function. Imagine a
plugin that lists all branches below a directory recursively printing
them to the terminal. It does not need to open any of these branches in
order to do so. It just needs to print their paths.

Cheers,

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

iEYEARECAAYFAkma828ACgkQ1+i51gqqEGkp9wCffQW9PlW4WrCf80274iWUOkrw
lbkAn2HJ1eEepJDoQiMkeeYu4D9Im7bE
=4W93
-----END PGP SIGNATURE-----



More information about the bazaar mailing list