# HG changeset patch
# User Steffen Daode Nurpmeso <sdaoden@googlemail.com>
# Date 1317166869 18000
#      Tue Sep 27 18:41:09 2011 -0500
# Branch stable
# Node ID 7ce7177e029a040648ed65048cab491ca6be86cc
# Parent  c208dcd0f70957ce871fdacbf8d1432021de79b5
patch: correctly handle non-tabular Subject: line

The line content of continued Subject: lines was yet joined via
str.replace('\n\t', ' '), which does not handle continuation via
spaces.  So expan the regular expression instead to
handle all allowed forms of mail header line continuation.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- 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)