[MERGE] (robertc) Use prejoined content for knit storage when performing a full-text store of unannotated content. (Robert Collins)

Robert Collins robertc at robertcollins.net
Fri Oct 5 04:02:50 BST 2007


On Thu, 2007-10-04 at 22:04 -0400, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robert Collins wrote:
> > This is a little ugly, but I can't see right now how to clean it up, so
> > submitting for review - if you can suggest a better structure for making
> > it hang together that does not involve a full overhaul of the knitdata|
> > content|factory relationships at this point, please suggest it!
> 
> bb:comment
> 
> Well, it seems like you could pass line_bytes into
> factory.lower_fulltext, and simply ignore it in
> KnitAnnotateFactory.lower_fulltext.
> 
> Or am I missing something?

_record_to_data needs to know the number of \n characters in the record
to write the prelude to the knit hunk, this is achieved by counting
'lines' as its input. Doing what you suggest results in a lowered
fulltext which is ["foo\nbar\n..."], and the length of the resulting
line count is thus 1, so the knit parser when it reads this record back
will fail.

I think the coupling between _record_to_data, and the representation is
awkward at the moment :(.

> > +    def _record_to_data(self, version_id, digest, lines, dense_lines=None):
> >          """Convert version_id, digest, lines into a raw data block.
> >          
> > +        :param dense_lines: The bytes of lines but in a denser form.
> 
> ^^^ This description doesn't help me understand what a "denser form" may be.

How about:
:param dense_lines: The bytes of lines but in a denser form. For
    instance, if lines is a list of 1000 bytestrings each ending in \n,
    dense_lines may be a list with one line in it, containing all the
    1000's lines and their \n's. Using dense_lines if it is already
    known is a win because the string join to create bytes in this
   function spends less time resizing the final string.

-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/20071005/3074a0d7/attachment.pgp 


More information about the bazaar mailing list