Mercurial > hg
comparison mercurial/patch.py @ 15158:7ce7177e029a stable
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.
author | Steffen Daode Nurpmeso <sdaoden@googlemail.com> |
---|---|
date | Tue, 27 Sep 2011 18:41:09 -0500 |
parents | db0646afb725 |
children | 85322c19c831 |
comparison
equal
deleted
inserted
replaced
15157:c208dcd0f709 | 15158:7ce7177e029a |
---|---|
186 if subject: | 186 if subject: |
187 if subject.startswith('[PATCH'): | 187 if subject.startswith('[PATCH'): |
188 pend = subject.find(']') | 188 pend = subject.find(']') |
189 if pend >= 0: | 189 if pend >= 0: |
190 subject = subject[pend + 1:].lstrip() | 190 subject = subject[pend + 1:].lstrip() |
191 subject = subject.replace('\n\t', ' ') | 191 subject = re.sub(r'\n[ \t]+', ' ', subject) |
192 ui.debug('Subject: %s\n' % subject) | 192 ui.debug('Subject: %s\n' % subject) |
193 if user: | 193 if user: |
194 ui.debug('From: %s\n' % user) | 194 ui.debug('From: %s\n' % user) |
195 diffs_seen = 0 | 195 diffs_seen = 0 |
196 ok_types = ('text/plain', 'text/x-diff', 'text/x-patch') | 196 ok_types = ('text/plain', 'text/x-diff', 'text/x-patch') |