how to browse shred repository for 'heads'?

Erik Bågfors zindar at gmail.com
Tue Jul 18 18:13:38 BST 2006


On 7/18/06, Alexander Belchenko <bialix at ukr.net> wrote:
> Robert Collins пишет:
> > On Tue, 2006-07-18 at 15:31 +0300, Alexander Belchenko wrote:
> >
> >>I want to ask this question many times but actually don't ask before.
> >>Today I do very bad mistake and break my work.
> >>
> >>If I have shared repository how I can browse all revisions inside it,
> >>revsions that does not have childs? IIRC, Mercurial have command 'hg
> >>heads' that prints all such revisions in similar situation. Is bzr does
> >>not have this interface?
> >
> > in the root of the repo:
> > $ python
> >
> >>>>import bzrlib.repository
> >>>>r = bzrlib.repository.Repository.open('.')
> >>>>g = r.get_revision_graph()
> >>>>possible_heads = set(g.keys())
> >>>>not_heads = set()
> >>>>for parents in g.values()
> >
> > ....     not_heads.update(set(parents))
> >
> >>>>heads = possible_heads.difference(not_heads)
> >
> >
> > should do it for you (untested)
>
> Thank you very much. It's indeed works for me.
> I restore my branch.
> Thank you again.

This is actually very cool. I can loose the branch "oldbranch" and
then bring it back again with "bzr head", then "bzr branch
-rrevid:xxxxx branch oldbranch.

The only odd thing, is that branch, really doesn't have anything to do
with oldbranch. It would be nice to be able to point to the repository
directory, instead of only another branch for the "bzr branch"
command.

/Erik


More information about the bazaar mailing list