?discover and lock branches

Maritza Mendez martitzam at gmail.com
Sat Apr 11 17:31:51 BST 2009

Thank you Aaron.  I made notes below. - M

On Sat, Apr 11, 2009 at 6:07 AM, Aaron Bentley <aaron at aaronbentley.com>wrote:

> 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?

Usually, yes.  Sometimes it would be good to selectively back up one branch
or repo instead of all.  If I want to backup a shared repo and I have
already locked all of its branches (children) then it seems like asking for
a lock on the shared repo (parent) might be an error.  I have just started
looking at the code and I'm trying to understand the semantics and use it

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.

  I begin to understand.

> 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.

Let me make sure I understand.
The .bzr directory of a standalone barnch has 'branch' and 'repository'
The .bzr directory of a shared repo has a 'repository' directory (and no
'branch' directory).
The .bzr directory of a branch in a shared repo has a 'branch' directory
(bit no 'repository' directory).
Every .bzr directory has a 'branch-lock' directory.
I just tried it, and that seems right.

So if I want backup just a single branch (shared or standalone) all I need
to do is lock it and copy it.
If I want to back up a shared repo, I need to lock all of its "children"
branches first, then lock itself and then copy them all.

Did I get that right?

I really appreciate your help!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20090411/822391cd/attachment.htm 

More information about the bazaar mailing list