\r
self.error(*lines)\r
\r
+ old_debug_re = \\r
+ re.compile(r'''\r
+ DEBUG \s* \( \s* \( \s*\r
+ (?: DEBUG_[A-Z_]+ \s* \| \s*)*\r
+ EFI_D_ ([A-Z_]+)\r
+ ''',\r
+ re.VERBOSE)\r
+\r
def check_added_line(self, line):\r
eol = ''\r
for an_eol in self.line_endings:\r
if len(stripped) < len(line):\r
self.added_line_error('Trailing whitespace found', line)\r
\r
+ mo = self.old_debug_re.search(line)\r
+ if mo is not None:\r
+ self.added_line_error('EFI_D_' + mo.group(1) + ' was used, '\r
+ 'but DEBUG_' + mo.group(1) +\r
+ ' is now recommended', line)\r
+\r
split_diff_re = re.compile(r'''\r
(?P<cmd>\r
^ diff \s+ --git \s+ a/.+ \s+ b/.+ $\r
''',\r
re.IGNORECASE | re.VERBOSE | re.MULTILINE)\r
\r
+ subject_prefix_re = \\r
+ re.compile(r'''^\r
+ \s* (\[\r
+ [^\[\]]* # Allow all non-brackets\r
+ \])* \s*\r
+ ''',\r
+ re.VERBOSE)\r
+\r
def find_patch_pieces(self):\r
if sys.version_info < (3, 0):\r
patch = self.patch.encode('ascii', 'ignore')\r
\r
self.commit_subject = pmail['subject'].replace('\r\n', '')\r
self.commit_subject = self.commit_subject.replace('\n', '')\r
-\r
- pfx_start = self.commit_subject.find('[')\r
- if pfx_start >= 0:\r
- pfx_end = self.commit_subject.find(']')\r
- if pfx_end > pfx_start:\r
- self.commit_prefix = self.commit_subject[pfx_start + 1 : pfx_end]\r
- self.commit_subject = self.commit_subject[pfx_end + 1 :].lstrip()\r
-\r
+ self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1)\r
\r
class CheckGitCommits:\r
"""Reads patches from git based on the specified git revision range.\r