?discover and lock branches

Aaron Bentley aaron at aaronbentley.com
Sat Apr 11 14:07:25 BST 2009


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

Maritza Mendez wrote:
> It looks like I can use b.b.BzrDir:find_branches or
> b.r.Repository:find_branches to recursively find all the repos under
> some base.   But some branches are standalone and others are shared. 

But don't you want to lock all of them?

If not, the code of Repository.find_branches will tell you how to
distinguish them.  The ``using`` argument determines whether all
branches are returned or just the ones that use the repository.

> Some might be nested,

That should have no bearing at all.

> Can someone please point me to the right section
> of the API to evaluate the branches I get back to  see what kind they are
> and so what order of locking I should use?  Am I even going in a good
> direction?  Maybe there is already a tool for this and I am wasting time!

We only take exclusive locks for write operations.  There's no problem
with one client reading a branch while the other writes to it.  Since
backing up is a read operation, I think you're going about this the
wrong way.

If you're doing filesystem operations, all you need to do is make sure
you process repositories after branches.  Shared repositories will be in
parent directories.  Unshared repositories have a .bzr/repository
directory, while branches have a .bzr/branch directory, so repositories
sort alphabetically lower than branches.

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

iEYEARECAAYFAknglgoACgkQ0F+nu1YWqI0znQCfQSvhBfZcR6J62qPnV6QhJPUE
qSgAn3u2hLJrx6k1ThJcCjpbEDbPHloL
=kJfn
-----END PGP SIGNATURE-----



More information about the bazaar mailing list