- # get the subject
- subject = descr_lines[0]
-
- # ignore the empty lines after subject
- while pos < end and descr_lines[pos] == '':
- pos += 1
-
- # check for a "From:" line
- if pos < end and re.match('from:\s+', descr_lines[pos], re.I):
- auth = re.findall('^.*?:\s+(.*)$', descr_lines[pos])[0]
- authname, authemail = name_email(auth)
- pos += 1
-
- # ignore the empty lines
- while pos < end and descr_lines[pos] == '':
- pos += 1
+ # Parse the patch header
+ for pos in range(0, end):
+ if not descr_lines[pos]:
+ continue
+ # check for a "From|Author:" line
+ if re.match('\s*(?:from|author):\s+', descr_lines[pos], re.I):
+ auth = re.findall('^.*?:\s+(.*)$', descr_lines[pos])[0]
+ authname, authemail = name_email(auth)
+ lasthdr = pos + 1
+ continue
+ # check for a "Date:" line
+ if re.match('\s*date:\s+', descr_lines[pos], re.I):
+ authdate = re.findall('^.*?:\s+(.*)$', descr_lines[pos])[0]
+ lasthdr = pos + 1
+ continue
+ if subject:
+ break
+ # get the subject
+ subject = descr_lines[pos]
+ lasthdr = pos + 1