[PATCH] patch.py: correctly handle non-tabulator Subject: line continuation

Matt Mackall mpm at selenic.com
Tue Sep 27 18:44:18 CDT 2011


On Thu, 2011-09-22 at 12:55 +0200, Steffen Daode Nurpmeso wrote:
> Heya Mercurial,
> 
> i've posted rather the same post almost one month ago, but since
> yesterdays tip still requires my patch, it maybe simply has been
> lost in holiday noise.  Thus i'll repost it today, with a full
> walk this time:


> --- a/mercurial/patch.py
> +++ b/mercurial/patch.py
> @@ -188,7 +188,7 @@
>                  pend = subject.find(']')
>                  if pend >= 0:
>                      subject = subject[pend + 1:].lstrip()
> -            subject = subject.replace('\n\t', ' ')
> +            subject = re.sub(r'\n[ \t]+', ' ', subject)
>              ui.debug('Subject: %s\n' % subject)
>          if user:
>              ui.debug('From: %s\n' % user)

I've queued this piece with your description from last month for stable,
thanks.

> @@ -251,7 +251,7 @@
>          raise
>  
>      if subject and not message.startswith(subject):
> -        message = '%s\n%s' % (subject, message)
> +        message = '%s\n\n%s' % (subject, message)
>      tmpfp.close()
>      if not diffs_seen:
>          os.unlink(tmpname)

This piece was mysterious, of suspicious correctness, and apparently
unrelated, so I dropped it.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list