[RFC] ghost aware apis

Martin Pool mbp at sourcefrog.net
Thu Mar 2 08:40:00 GMT 2006


On 28 Feb 2006, Robert Collins <robertc at robertcollins.net> wrote:
> Ok, after chatting with aaron I think the following ghost aware apis are
> what we need, and we should aim to get them into the mainline as soon as
> convenient...
> 
> For the following samples the revision graph is:
> {3:[2],
>  2:[1,0],
>  1:[0],
>  0:[],
>  }
> 
> and revisions 1 and 0 are ghosts, and we have no cache of ancestry data
> for ghosts.
> 
> A replacement for getting the ancestry for a revision that is ghost
> aware, lets say its called get_ancestry_ghosts. This returns a list of
> the topologically sorted ancestors of revision_id, and all the ghosts in
> that list.
> 
> That is:
> get_ancestry_ghosts(3) -> [0, 1, 2, 3], set([0, 1])
> get_ancestry_ghosts(1) -> [1], set([1])
> get_ancestry_ghosts(0) -> [0], set([0])
> 
> Secondly, an api to get the revision graph as a map which will also
> return a set of the ghosts:
> get_ancestry_graph(3) -> {3:[2], 2:[1,0], }, set([0, 1])
> get_ancestry_graph(1) -> {}, set()
> 
> 
> Thoughts? sound good?

Yes the basic idea sounds reasonable.  I wouldn't want to excessively
proliferate multi-return methods, but it seems like a decent fit here. 
I might rename it to get_ancestry_with_ghosts -- get_ancestry_ghosts
might be taken to imply it returns only the ghosts.

-- 
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060302/d969cac7/attachment.pgp 


More information about the bazaar mailing list