[PATCH V3] summary, changelog, compare: make the comments counts more accurate

Angel Ezquerra angel.ezquerra at gmail.com
Tue Mar 1 22:53:48 UTC 2016


On Mon, Feb 29, 2016 at 5:28 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 02/26/2016 09:54 PM, Angel Ezquerra wrote:
>>
>> diff --git a/kallithea/model/db.py b/kallithea/model/db.py
>> --- a/kallithea/model/db.py
>> +++ b/kallithea/model/db.py
>> @@ -1389,6 +1389,16 @@
>>               grouped[cmt.revision].append(cmt)
>>           return grouped
>>   +    def count_comments(self, comments):
>> +        """
>> +        Returns the count of (non-empty) comments for this repository
>> grouped by revisions
>> +
>> +        :param comments: a {revision: comment} dict, as returned by
>> get_comments()
>> +        """
>> +        def count_revision_comments(revision_comments):
>> +            return len([cm for cm in revision_comments if cm.text])
>> +        return {raw_id: count_revision_comments(revision_comments) for
>> raw_id, revision_comments in comments.iteritems()}
>
>
> get_comments will sometimes return a list ... which doesn't have .iteritems.
>
> That is a flaw which so far hasn't been fatal. I will fix that. But it shows
> very little local testing of this change ... and that the test suite hasn't
> been run.
>
>
> Also, working with PRs will also end up with calling compare_cs.html ... and
> crash.

I have not run the test suite. Does it run on windows? I don't have
Kallithea running on default. It is not enough to just update the
kallithea source repo to default it seems. I did quite a bit of manual
testing, but I did not test the PR code which I have never used,
sorry!

Angel


More information about the kallithea-general mailing list