HowTo obtain list or directory of branches in a repository

James Westby jw+debian at jameswestby.net
Tue Mar 18 18:37:38 GMT 2008


On Tue, 2008-03-18 at 18:17 +0100, Nathan Johnson wrote:
> Once a repository is made with
>         init-repository
> or
>         init-repository --no-trees
> , how can a user discover what branches are in the repository?
> If this is in the documentation, I'd be thankful for and consider it ample 
> help to be told what document and chapter.
> 

Hi,

The function to do that is only exposed at API level, not at command
level.

The function is called Repository.find_branches()

You could write a very simple plugin to expose this as a command.
If you explain what output you need perhaps I could do it for you.

> Piggybacking this e-mail with another issue:
> Is this error expected behavior?
> 
> bzr shell
> bzr> init-repository --no-trees .
> bzr> init ARepo
> bzr> cd ARepo
> bzr> add
> No WorkingTree exists for 
> "file:///rhefos/njo/Repository/ARepo/.bzr/checkout/".
> 
> If so, I don't understand how to use a --no-trees repository.
> 

Yes, that's expected behaviour.

You are doing an add, which is an operation on the working tree.
However you are in a branch created inside a no-trees repo. No-trees
means that you don't want the branches within it to have working trees.

no-trees repos are usually used for storage on a server where you don't
want working trees as no-one will use them, so you don't want to waste
the space. There are other uses as well.

To force a working tree inside a no-trees repo use "bzr checkout ."
inside the branch.

Thanks,

James







More information about the bazaar mailing list