API issues

Robert Collins robertc at robertcollins.net
Fri Sep 16 12:35:02 BST 2005


On Fri, 2005-09-16 at 10:59 +1000, Martin Pool wrote:

> > Functions are not bad at all, but using many different approaches
> > creates inconsistencies, and this is undesirable. Currently, we have
> > the add.smart_add() function which calls the Branch.add() class/method,
> > but no remove.smart_remove() and no remove.py at all. OTOH, we do have
> > commit.py, and we have the Branch.commit() class/method which actually
> > calls the commit.commit() function blindly (no arg check), and the later
> > is a one liner which calls the Commit().commit() class/method blindly
> > again.
> > 
> > This is looking a bit uncomfortable, IMO. 
> 
> I agree.  There are different patterns because we're still learning
> about the space, not because I like them being inconsistent.  At first
> a lot of things were done directly in Branch and that got
> unmanageable.
> 
> Perhaps things like commit.py and add.py should be called only by the
> Branch object and put there just to move the implementation of the
> code away from the Branch class.

I think that the placement of methods is really driven by what aspects
of commit/add etc branch subclasses may wish to change. Functions
outside the class don't change the need for that parameterisation to
happen on the class, and in fact make it less clear what its going on
IME.

That said, things like commit which are transactions in their own right
probably dont need to be directly on branch - though calling via branch
would allow parameterisation (i.e. a subclass of CommitTransaction) to
change behaviour for branch types.

separately... the bulk of stuff on branch at the moment appears to be
man in the middle syndrome to me. (for instance the revision processing
which Lalo just moved out of branch, or the retrieval of things from the
stores..).

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: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050916/6a1fc242/attachment.pgp 


More information about the bazaar mailing list