[PATCH 2 of 2] releasenotes: add similarity check function to compare incoming notes

Rishabh Madan rishabhmadan96 at gmail.com
Fri Jul 7 02:06:31 EDT 2017


On Wed, Jul 5, 2017 at 3:44 PM, Yuya Nishihara <yuya at tcha.org> wrote:

> On Mon, 03 Jul 2017 23:06:31 +0200, Rishabh Madan wrote:
> > # HG changeset patch
> > # User Rishabh Madan <rishabhmadan96 at gmail.com>
> > # Date 1499115687 -7200
> > #      Mon Jul 03 23:01:27 2017 +0200
> > # Node ID 1fc4f41fadcca56d36edd0747a09e1be6af5f680
> > # Parent  6684514628b44e838f499b2125ffebe8d700a204
> > releasenotes: add similarity check function to compare incoming notes
>
> Can you think more about how to split testable functions?
>


> For instance, maybe there could be a boolean function that returns whether
> the new paragraph should be added or not.
>
>   if f(section, paragraphs):
>       self.addtitleditem(section, title, paragraphs)
>   ...
>   if f(section, paragraphs):
>       self.addnontitleditem(section, paragraphs)
>
> Since the function 'f' depends on 'all_points', which has wider scope (*1),
> 'f' might be a class that holds pre-computed 'all_points'.
>
>   f = x()
>   x.addknownparagraphs(paragraphs for _title, paragraphs
>                        in self.titledforsection(section))
>   ...
>

I get what you're trying to suggest. I'll make similar changes and send a
new patch.
ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170707/5fcd19e2/attachment.html>


More information about the Mercurial-devel mailing list