[PATCH 0 of 2] [mq:qrefresh] Better handle setting/updating the date in the patch

Martin Geisler mg at lazybytes.net
Wed Aug 5 16:25:49 CDT 2009


"Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr> writes:

> On Wednesday 05 August 2009 13:15:05 Dirkjan Ochtman wrote:
>
>> It looks promising, but I spot at least one coding style issue.
>
> Line too long, is it? How should it be written? These are my very
> first lines of code in Python...

You're off to a very good start! :-) Perhaps Dirkjan meant the comma not
followed by a space:

    self.comments.insert(patchheaderat + 1,'# Date ' + date)

Apart from that and the long lines, I'm not sure how to best manipulate
these lists.

> Would something like the following be better?
> --8<--
>             except ValueError:
>                 tmp = ['# HG changeset patch', '# Date ' + date, '']
>                 self.comments = tmp + self.comments
> --8<--

I would like it even better like this:

                  tmp = 
                  self.comments = (['# HG changeset patch',
                                    '# Date ' + date, ''] +
                                   self.comments)

That is, you can wrap your code freely within parenthesis.

>> More importantly, send the messages with patches inline, so that they
>> might be more easily reviewed.
>
> That's what I intended to do, using the patchbomb extension as:
>   hg email --inline [....]
>
> Is that wrong? What should I have done?

Ah, that is indeed confusing!

The --inline flag makes patchbomb send out emails containing attachments
with Content-Disposition: inline. Real email clients --- unlike Gmail,
which I believe Dirkjan is using... :-) --- will then display the
attachments inline. I see your attachments this way, and they are even
syntax highlighted because of the text/x-patch content type.

What he meant was that you should not use the --inline flag. That will
make patchbomb send out mails with the patch included directly as the
email body text. That leads to all sorts of funny accidents when people
send patches that contain non-ASCII characters, but for most patches it
works okay.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090805/4471c1a1/attachment.pgp 


More information about the Mercurial-devel mailing list