[RFC] Joining of annotated and plain knits

Ian Clatworthy ian.clatworthy at internode.on.net
Tue Sep 25 00:58:06 BST 2007


Robert Collins wrote:

>> +    if 'fulltext' in options:
>> +        return [line.split(' ', 1)[1] for line in lines]
>> +    else:
>> +        # line delta - leave 1st line alone
>> +        return [lines[0]] + [line.split(' ', 1)[1] for line in
>> lines[1:]]
> 
> This is a bit naughty - the KnitFactory class currently has the parsing
> and serialisation code, layer wise it would be better to do something
> like

Agreed. I'll clean that up.

>> +def _plain_to_anno_converter(lines, version_id, options):
>> +    """Convert plain lines to annotated lines."""
>> +    if 'fulltext' in options:
>> +        return ['%s %s' % (version_id,line) for line in lines]
>> +    else:
>> +        # line delta - leave 1st line alone
>> +        return [lines[0]] + ['%s %s' % (version_id,line) for line in
>> lines[1:]]
> 
> This case fails because you are claiming to know the annotations, but
> this is bogus - you don't.
[snip]
> So, the simplest thing when converting from plain to annotated, the
> 'right thing' to do is probably to reconstruct the full text always,
> then to call self.target.add_lines_with_ghosts - you can pass in the
> convert parent records to speed this up (the last element of the return
> value of add_lines_with_ghosts can be put in a dict and passed back in).

Thanks. I'll get my head around that and try that now.

> A more complex solution would be to take advantage of the deltas in the
> chain of the merged parents to reduce the amount of data processing; but
> honestly, lets get this robust and visibly correct, and see how long it
> takes, before stressing.

Sure.

Ian C.



More information about the bazaar mailing list