API issues

Martin Pool martinpool at gmail.com
Fri Sep 16 01:57:05 BST 2005


On 15/09/05, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> Scott James Remnant wrote:
> > A few bzrlib API issues that have made implementing something based on
> > top of it a little tricky.
> >
> >
> > smart_add_branch() is great, we can pass in a branch object and a
> > reporter callback function and get the feedback we need.  Though it
> > feels wrong calling a separate function -- could this not be bzrlib.add
> > itself?
> 
> I think Branch is the wrong layer for DWIM.  

I think it is good to keep the DWIM user-oriented functions separate
from the basic objects (so to have smart_add rather than add.)  At the
same time it's useful for programs calling the library, so shouldn't
be in cmd_add.  Therefore, an intermediate layer.  Since Branch is the
lower-level object it's just a function.  (It's not perfect,
suggestions are welcome.)

> If you want to do this, I'd
> much rather see it in a SmartBranch class that delegated to a branch
> member.  That way, the branch API is simpler and easier to reimplement.

Aaron also pointed out the other day that operations like add, rename,
move, etc should really be done on the WorkingTree not on the branch. 
I'd like to separate them that way.

It seems like many operations want to become operations on Branch but
it also seems wrong to have that object end up with hundreds of
methods; it probably has too many already.

-- 
Martin




More information about the bazaar mailing list