[MERGE] Change the signature on VersionedFiles adapters to allow less typing and more flexability inside adapters.

Robert Collins robertc at robertcollins.net
Mon Feb 16 20:59:15 GMT 2009


On Mon, 2009-02-16 at 09:25 -0600, John Arbash Meinel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robert Collins wrote:
> > ``VersionedFiles`` record adapters have had their signature change
> > from ``(record, record.get_bytes_as(record.storage_kind))`` to
> > ``(record)`` reducing excess duplication and allowing adapters
> > to access private data in record to obtain content more
> > efficiently. (Robert Collins)
> > 
> > This reduces friction showing up in the
> > versionedfiles-for-network-streaming project I am working on with
> > Andrew.
> > 
> > -Rob
> > 
> 
> Would it be reasonable to do this in a more backwards compatible fashion
> by doing:
> 
> 
> - -    def get_bytes(self, factory, annotated_compressed_bytes):
> +    def get_bytes(self, factory, annotated_compressed_bytes=None):
>        if annotated_compressed_bytes is None:
>          annotated_compressed_bytes = factory.read_bytes_as(....)

We could, but I'm only aware of one external module using the adapters
directly, and I've already fixed it (groupcompress).

It will have a noticable performance cost for someone that does not
update their use of the API, which is why I chose to cause an immediate
error rather than a transition phase.

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090217/e3af55c1/attachment.pgp 


More information about the bazaar mailing list