[PATCH 6 of 7 🚿🍦] patchbomb: extract 'makeintro' closure in its own function

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Nov 6 12:54:56 CST 2014



On 11/06/2014 06:03 PM, Martin von Zweigbergk wrote:
>
>
> On Thu Nov 06 2014 at 7:47:17 AM Pierre-Yves David
> <pierre-yves.david at ens-lyon.org <mailto:pierre-yves.david at ens-lyon.org>>
> wrote:
>
>     # HG changeset patch
>     # User Pierre-Yves David <pierre-yves.david at fb.com
>     <mailto:pierre-yves.david at fb.com>>
>     # Date 1415275068 0
>     #      Thu Nov 06 11:57:48 2014 +0000
>     # Node ID 1c2a64da69f91d37af44d0126ea2c3__d73b3a8790
>     # Parent  2d48ca81fd12986424d08a7abd6fda__eaa1d832d7
>     patchbomb: extract 'makeintro' closure in its own function
>
>     Keep marching toward the promised land of simplification!
>
>     diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
>     --- a/hgext/patchbomb.py
>     +++ b/hgext/patchbomb.py
>     @@ -255,10 +255,44 @@ def _getbundlemsgs(repo, sender, bundle,
>           email.Encoders.encode_base64(__datapart)
>           msg.attach(datapart)
>           msg['Subject'] = mail.headencode(ui, subj, _charsets,
>     opts.get('test'))
>           return [(msg, subj, None)]
>
>     +def _makeintro(repo, sender, patches, **opts):
>     +    """make an introduction email, asking the using for a content
>     if needed
>     +
>     +    email is returned as (subject, body, cumulative-diffstat)"""
>     +    ui = repo.ui
>
>     +    _charsets = mail._charsets(ui)
>
>
> Move closer to its first use (and after some early returns) unless you
> plan on doing that later?

I was available globally and early before, I makes it available globally 
and early too. This can be improved in non-code-movement changesets.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list