how to browse shred repository for 'heads'?

Robert Collins robertc at robertcollins.net
Tue Jul 18 13:34:32 BST 2006


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?
> 
> Use case for this command will be: user has shared repo with branches 
> inside. If user eventually delete branch it lose information how to 
> ressurect this branch (if this branch was not merged to another branch).
> 
> I think that browsing of revisions.knit should do what I want, but at 
> this moment I don't understand how to do this.

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)

HTH,
Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060718/5b63b344/attachment.pgp 


More information about the bazaar mailing list