[PATCH] Factor out duplicate code

Robert Collins robertc at robertcollins.net
Wed Oct 12 23:54:34 BST 2005


On Tue, 2005-10-11 at 18:45 -0700, Dan Loda wrote:
> ... by adding a factory method to InventoryEntry.
> 
> I'm new to Python; constructive criticism is most welcome ;)
> 
> Great job on 0.1.

Thanks for this Dan, I'll certainly merge in a variation.

In respect to the feedback, what I think has largely been overlooked is
that the different types of entry need different information:

when someone is creating an entry from flat data - 'kind', 'id', 'parent
id', 'name', often more data is available/needed - 'text_sha1',
'symlink_target' etc.

I think that the dictionary is an unuseful optimisation, because it does
not take into account the differences - that a dir must not get a
text_sha1 value and that a symlink can recieve a symlink_target
parameter.

So - a single static method with a lot of parameters - yes, but with an
if block.

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/20051013/278a84c6/attachment.pgp 


More information about the bazaar mailing list