summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-10-17 11:12:04 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2016-10-21 07:25:22 +0800
commite709bbb1ce386c7ac4240fae929cacfcc2bfa5a9 (patch)
treed084e8f32f084e69dcb0f5b28f5214eea4e50bf8
parente61406708c83f96d3dc2e8899716cce43c058491 (diff)
downloadedk2-e709bbb1ce386c7ac4240fae929cacfcc2bfa5a9.tar.gz
edk2-e709bbb1ce386c7ac4240fae929cacfcc2bfa5a9.tar.bz2
edk2-e709bbb1ce386c7ac4240fae929cacfcc2bfa5a9.zip
BaseTools/PatchCheck.py: Update to handle the two [] as prefix
The bug is that only remove the first [] when it does the char count, however sometimes we use [edk2][patch] as prefix, this patch fix this bug. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=113 Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
-rwxr-xr-xBaseTools/Scripts/PatchCheck.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 07fca68149..05f8f6e407 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -436,6 +436,14 @@ class CheckOnePatch:
''',
re.IGNORECASE | re.VERBOSE | re.MULTILINE)
+ subject_prefix_re = \
+ re.compile(r'''^
+ \s* (\[
+ [^\[\]]* # Allow all non-brackets
+ \])* \s*
+ ''',
+ re.VERBOSE)
+
def find_patch_pieces(self):
if sys.version_info < (3, 0):
patch = self.patch.encode('ascii', 'ignore')
@@ -472,14 +480,7 @@ class CheckOnePatch:
self.commit_subject = pmail['subject'].replace('\r\n', '')
self.commit_subject = self.commit_subject.replace('\n', '')
-
- pfx_start = self.commit_subject.find('[')
- if pfx_start >= 0:
- pfx_end = self.commit_subject.find(']')
- if pfx_end > pfx_start:
- self.commit_prefix = self.commit_subject[pfx_start + 1 : pfx_end]
- self.commit_subject = self.commit_subject[pfx_end + 1 :].lstrip()
-
+ self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1)
class CheckGitCommits:
"""Reads patches from git based on the specified git revision range.