[PATCH] Tests for KnitContent class
John Arbash Meinel
john at arbash-meinel.com
Sun Nov 26 14:44:19 GMT 2006
Dmitry Vasiliev wrote:
> Johan Rydberg wrote:
>> Dmitry Vasiliev <lists at hlabs.spb.ru> writes:
>>
>>> While learning Bazaar codebase I've wrote tests for KnitContent
>>> class. BTW it seems methods KnitContent.line_delta(_iter) don't used
>>> anywhere?
>>
>> The patch seems kinda straight forward, at least the changes to
>> knit.py. Didn't really look at the tests though :)
>
> The tests is also straight forward. :-)
>
>> +1 from me for the knit changes.
>
> Actually the KnitContent's interface looks incomplete for me because of
> so many places where KnitContent._lines is directly accessed.
>
Is this internal to KnitContent, or external? Meaning is KnitIndex
accessing KnitContent._lines?
I don't think there would be a problem with either:
1) Changing places that use it to use KnitContent.annotate_iter
2) Providing an 'def __iter__()' so that we could just use:
for origin, line in content:
I think the KnitContent interface is as it is, because of trying to look
like the VersionedFile api, rather than just being what it is, which is
a private Knit helper class.
KnitVersionedFile needs to maintain the interface, but KnitContent doesn't.
I realize KnitContent isn't technically private (because it doesn't have
a leading '_'.) But I think it was logically meant to be private. So I
personally would approve making it private. And if we really wanted we
could have a deprecated
@deprecated(zero_fourteen)
def KnitContent(*args, **kwargs):
"""KnitContent is supposed to be private."""
return _KnitContent(*args, **kwargs)
I *really* doubt anyone is creating a KnitContent outside of knit.py, so
this shouldn't cause any problems. (bzrlib itself doesn't)
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061126/50d7dece/attachment.pgp
More information about the bazaar
mailing list