[PATCH 2 of 6] mq: code simplification/beautification in updateheader

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Tue Aug 11 16:48:25 CDT 2009


Martin,
All,

On Tuesday 11 August 2009 23:16:14 Martin Geisler wrote:
> "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr> writes:
> > On Tuesday 11 August 2009 00:05:12 Martin Geisler wrote:
> >> I'm not an expert on the mq code, but I think the old code was
> >> necessary: it updates *all* comments that begin with *any* of the
> >> prefixes. So a call like
> >>   self.updateheader(['From: ', '# User '], user)
> >> will update both the email-like header and the patch header.
> >
> > Yes, indeed; that's what the current code does. But is it possible
> > that both fields be present in the same patch? From what I understood,
> > only one of them could be present.
> 
> Okay, I didn't know that, I was just unsure if the change in
> functionality was done on purpose.

I just inferred this would be the case, from:
- qnew adds email-like headers, not extended headers (should that be
  changed/fixed?)
- qref keeps the format as-is
- qimport keeps email-like headers

Thus I concluded that the patch could not have both types. But of course,
someone more literate in mq than I am could easily prove me wrong!

Anyway, I'll leave the patch series as is, and if the old behavior is
really wanted, then the commiter will just have to skip patch 2/6.

Still, I think that _hasheader could be merged into updateheader, and
replacement would occur only if new != None (I understand that None for
strings in Python is the equivalent of NULL for char* in C). What do you
guys think?

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



More information about the Mercurial-devel mailing list